* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --app-header-height: 88px;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/SpaceGrotesk-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: "Space Grotesk", "Inter", "Segoe UI", sans-serif;
  background-color: #fbfbfa;
  background-image: radial-gradient(#e1e1dd 1px, transparent 1px);
  background-size: 28px 28px;
  color: #2f3437;
  min-height: 100vh;
  user-select: none;
  overflow: hidden;
}

.dashboard-body {
  background-image: none;
  background-color: #fbfbfa;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: transparent;
  border-bottom: none;
  backdrop-filter: none;
  position: relative;
  z-index: 20;
}

.editor-body .app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}

.map-title {
  font-size: 20px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 10px;
  background: #f7f7f5;
  border: 1.5px solid #c9c9c3;
  box-shadow: 0 8px 16px rgba(60, 60, 67, 0.12);
  color: #2f3437;
  font-family: inherit;
  height: 34px;
  display: flex;
  align-items: center;
  font-weight: 600;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1.5px solid #c9c9c3;
  background: #f7f7f5;
  padding: 2px;
  box-shadow: 0 6px 12px rgba(60, 60, 67, 0.12);
  object-fit: contain;
}

.app-logo.plain {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  width: 42px;
  height: 42px;
}

.app-header p {
  color: #6b6b6b;
  font-size: 13px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-right: 0;
}

.auth-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auth-status {
  font-size: 12px;
  color: #6b6b6b;
}

.save-status {
  font-size: 12px;
  color: #6b6b6b;
}

.auth-status:empty {
  display: none;
}

.save-status:empty {
  display: none;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

button,
button * {
  user-select: none;
  -webkit-user-select: none;
}

.toolbar,
.toolbar *,
.node-menu,
.node-menu * {
  user-select: none;
  -webkit-user-select: none;
}

.toolbar input,
.toolbar textarea,
.node-menu input,
.node-menu textarea {
  user-select: text;
  -webkit-user-select: text;
}


.workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 88px);
}

.editor-body .workspace {
  display: block;
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
}

.toolbar {
  background: #f7f7f5;
  border: 1.5px solid #cfcfc9;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: width 0.2s ease, padding 0.2s ease, border-color 0.2s ease;
  position: relative;
  z-index: 15;
  margin: 18px 0 18px 28px;
  border-radius: 14px;
  box-shadow: 0 12px 24px rgba(60, 60, 67, 0.12);
  user-select: none;
}

.editor-body .toolbar {
  position: fixed;
  top: calc(var(--app-header-height) + 2px);
  left: 28px;
  width: 252px;
  height: calc(100vh - var(--app-header-height) - 26px);
  margin: 0;
  overflow-y: auto;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.toolbar.hidden {
  width: 0;
  padding: 0;
  border-color: transparent;
  overflow: hidden;
}

.editor-body .toolbar.hidden {
  width: 252px;
  padding: 16px;
  border-color: #cfcfc9;
  overflow: visible;
  transform: translateX(calc(-100% - 28px));
  opacity: 0;
  pointer-events: none;
}

.workspace.toolbar-hidden {
  grid-template-columns: 0 1fr;
}

.editor-body .canvas-wrap {
  position: absolute;
  inset: 0;
}



.section h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  color: #6b6b6b;
}

.section > button {
  width: 100%;
  height: 34px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid #c9c9c3;
  background: #ffffff;
  color: #2f3437;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.section > button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 18px rgba(60, 60, 67, 0.14);
  background: #ffffff;
}

.section > button:active {
  transform: translateY(0);
  box-shadow: 0 8px 12px rgba(60, 60, 67, 0.12);
}

.section > button:last-child {
  margin-bottom: 0;
}

.section > button.danger {
  background: #fff1f0;
  border-color: #f2c7c4;
  color: #b42318;
}

.section label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #6b6b6b;
  margin-bottom: 10px;
}

.file-input {
  position: relative;
  border: 1.5px solid #c9c9c3;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  color: #2f3437;
  background: #ffffff;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  overflow: hidden;
}

.file-input:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 18px rgba(60, 60, 67, 0.14);
  background: #ffffff;
}

.file-input:active {
  transform: translateY(0);
  box-shadow: 0 8px 12px rgba(60, 60, 67, 0.12);
}

.file-input.icon {
  justify-content: flex-start;
  padding: 6px 8px;
  font-size: 11px;
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  column-gap: 10px;
  color: #2f3437;
}

.node-menu .file-input.icon {
  width: 100%;
  display: grid;
  justify-content: flex-start;
  text-align: left;
  grid-template-columns: 20px 1fr;
  column-gap: 10px;
  padding: 7px 10px;
  font-size: 12px;
  color: #2f3437;
}

.node-menu .file-input.icon .icon-glyph {
  width: 16px;
  height: 16px;
}

.file-input.icon .icon-glyph {
  width: 19px;
  height: 19px;
  display: inline-block;
}

.file-input.inline {
  align-self: flex-start;
}

.file-input input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-label-text {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section input[type="text"],
.section textarea {
  border: 1.5px solid #c9c9c3;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  background: #ffffff;
  color: #2f3437;
}

.section textarea {
  resize: vertical;
}

.link-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-field input {
  flex: 1;
  min-width: 0;
  height: 34px;
}

.link-field .ghost {
  height: 34px;
  padding: 8px 12px;
  white-space: nowrap;
}

.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.is-disabled .color-trigger,
.is-disabled .custom-select,
.is-disabled .file-input {
  pointer-events: none;
}

.is-disabled .color-trigger:hover,
.is-disabled .custom-select .select-trigger:hover,
.is-disabled .file-input:hover {
  transform: none;
  box-shadow: none;
  background: inherit;
}

.custom-select.is-disabled .select-trigger,
.custom-select.is-disabled .select-trigger:hover {
  pointer-events: none;
  transform: none;
  box-shadow: none;
  background: #ffffff;
}

.is-disabled:hover,
.is-disabled:active {
  transform: none;
  box-shadow: none;
}

.custom-select {
  position: relative;
}

.custom-select .select-trigger {
  width: 100%;
  border: 1.5px solid #c9c9c3;
  border-radius: 8px;
  padding: 6px 32px 6px 10px;
  background: #ffffff;
  font-size: 12px;
  color: #2f3437;
  text-align: left;
  cursor: pointer;
  position: relative;
  font-family: inherit;
}

.custom-select .select-trigger::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20'%3E%3Cpath fill='%236b6b6b' d='M5.5 7.5L10 12l4.5-4.5'/%3E%3C/svg%3E") no-repeat center;
  background-size: 12px;
}

.custom-select .select-options {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 1px);
  background: #ffffff;
  border: 1.5px solid #c9c9c3;
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 12px 24px rgba(60, 60, 67, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 30;
}

.custom-select.open .select-options {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.custom-select .select-options button {
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: #2f3437;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.custom-select .select-options button:hover,
.custom-select .select-options button.active {
  background: rgba(0, 0, 0, 0.06);
}

.section input[type="range"],
.node-menu input[type="range"],
.export-menu input[type="range"] {
  accent-color: #b8b8b2;
  height: 6px;
  width: 100%;
}

.section input[type="range"]::-webkit-slider-thumb,
.node-menu input[type="range"]::-webkit-slider-thumb,
.export-menu input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f7f7f5;
  border: 1.5px solid #c9c9c3;
}

.section input[type="range"]::-moz-range-thumb,
.node-menu input[type="range"]::-moz-range-thumb,
.export-menu input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f7f7f5;
  border: 1.5px solid #c9c9c3;
}

.color-select {
  position: relative;
  display: inline-flex;
  align-self: flex-start;
  width: fit-content;
}

.color-trigger {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid #c4c4be;
  background: #4f46e5;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-trigger .color-dot {
  display: none;
}

.color-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 160px;
  background: #ffffff;
  border: 1.5px solid #c9c9c3;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 12px 24px rgba(60, 60, 67, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 30;
  display: flex;
  flex-direction: column;
}

.color-select.open .color-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.color-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-section + .color-section {
  margin-top: 8px;
}

.color-title {
  font-size: 11px;
  color: #6b6b6b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.color-grid button {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid #c9c9c3;
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.color-grid button.selected {
  outline: 2px solid #2f3437;
  outline-offset: 2px;
}

.color-picker {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid #c9c9c3;
  background: conic-gradient(
    #ff3b30,
    #ff9500,
    #ffcc00,
    #34c759,
    #5ac8fa,
    #007aff,
    #af52de,
    #ff3b30
  );
  cursor: pointer;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
  background: transparent;
}

.color-picker::-moz-color-swatch {
  border: none;
  border-radius: 6px;
  background: transparent;
}

.color-grid button:hover,
.color-trigger:hover,
.color-picker:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 18px rgba(60, 60, 67, 0.14);
}

.color-edit-btn {
  margin-top: 6px;
  align-self: flex-end;
  font-size: 11px;
  color: #bdbdb7;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
  display: inline;
  width: auto;
}

.color-edit-btn:hover {
  text-decoration: underline;
  color: #2e3437;
}

.section .color-edit-btn,
.node-menu .color-edit-btn {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  color: #bdbdb7;
  font-weight: 500;
}

.section .color-edit-btn:hover,
.node-menu .color-edit-btn:hover {
  transform: none;
  box-shadow: none;
  background: transparent;
  color: #2e3437;
}

.color-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: #ffffff;
  color: #2f3437;
  font-size: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 1px solid #c9c9c3;
}

.color-select.editing .color-grid button.is-removable .color-remove {
  display: flex;
}

.section ul {
  list-style: disc;
  padding-left: 18px;
  font-size: 12px;
  color: #6b6b6b;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header-dropdown {
  position: relative;
  display: inline-flex;
}

.header-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1.5px solid #c9c9c3;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 12px 24px rgba(60, 60, 67, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 30;
  width: 260px;
}

.header-dropdown.open .header-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.header-menu h3 {
  font-size: 13px;
  color: #2f3437;
  margin-bottom: 8px;
}

.header-menu ul {
  list-style: disc;
  padding-left: 18px;
  font-size: 12px;
  color: #6b6b6b;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.export-menu {
  width: 280px;
  background: #fbfbfa;
}

.export-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.export-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.export-label {
  font-size: 12px;
  color: #6b6b6b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.export-options {
  display: flex;
  gap: 8px;
}

.export-option {
  flex: 1 1 0;
  border: 1.5px solid #c9c9c3;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 500;
  background: #f7f7f5;
  color: #2f3437;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 14px rgba(60, 60, 67, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.export-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 16px rgba(60, 60, 67, 0.16);
  background: #ffffff;
}

.export-option.is-active {
  background: #ffffff;
  border-color: #a8a8a1;
  box-shadow: inset 0 0 0 1px rgba(47, 52, 55, 0.06), 0 8px 14px rgba(60, 60, 67, 0.16);
}

.export-center {
  padding: 4px 8px;
  font-size: 11px;
  height: auto;
}

.export-preview {
  border: none;
  border-radius: 12px;
  background: transparent;
  padding: 0;
}

.export-paper {
  width: 100%;
  aspect-ratio: 210 / 297;
  background: #ffffff;
  border: 1.5px solid #c9c9c3;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
  position: relative;
  overflow: hidden;
  cursor: grab;
}

.export-paper.landscape {
  aspect-ratio: 297 / 210;
}

.export-paper.dragging {
  cursor: grabbing;
}

.export-preview-map {
  position: absolute;
  inset: 0;
  transform-origin: top left;
  pointer-events: none;
}

.export-scale-value {
  font-size: 11px;
  color: #6b6b6b;
}

.toolbar .section {
  padding-bottom: 14px;
  border-bottom: 1px solid #e6e6e3;
}

.toolbar .section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
}

.canvas {
  position: relative;
  width: 100%;
  height: 100%;
  background: transparent;
  cursor: grab;
}

.canvas.panning {
  cursor: grabbing;
}

.canvas-inner {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  overflow: visible;
}

.links {
  position: absolute;
  overflow: visible;
  pointer-events: none;
}

.link {
  stroke: #a1a1aa;
  stroke-width: 2;
  transition: stroke 0.2s ease, opacity 0.2s ease;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link.highlight {
  stroke: #007aff;
  stroke-width: 3;
}

.link.dim {
  opacity: 0.3;
}

.mindmap-node {
  position: absolute;
  padding: 10px 18px;
  min-width: 120px;
  width: max-content;
  cursor: grab;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  user-select: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 20px rgba(60, 60, 67, 0.15);
  overflow: visible;
}

.mindmap-node.image-node {
  padding: 0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
}

.mindmap-node.image-node img {
  width: 100%;
  height: var(--image-height, 120px);
  object-fit: contain;
  display: block;
  background: transparent;
  border-radius: 8px 8px 0 0;
}

.mindmap-node.image-node .label {
  position: static;
  background: #f7f7f5;
  color: #2f3437;
  padding: 6px 8px;
  font-size: 12px;
  border-top: none;
  text-align: center;
  z-index: 1;
  white-space: normal;
  word-break: break-word;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border-radius: 8px;
  overflow: hidden;
}

.mindmap-node.image-node .resize-handle {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #9cc9f8;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  opacity: 0;
  cursor: nwse-resize;
  z-index: 2;
}

.mindmap-node.image-node .resize-handle::before {
  content: "";
}

.mindmap-node.image-node.selected .resize-handle {
  opacity: 1;
}

.mindmap-node:active {
  cursor: grabbing;
}

.mindmap-node.selected {
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.35), 0 14px 30px rgba(0, 122, 255, 0.4);
  transform: translate(-50%, -50%) scale(1.03);
}

.mindmap-node.hovered:not(.selected) {
  box-shadow: 0 10px 22px rgba(60, 60, 67, 0.2);
  transform: translate(-50%, -50%) scale(1.02);
}

.mindmap-node .label {
  outline: none;
  user-select: none;
  cursor: inherit;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
  text-align: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 2px 6px;
  pointer-events: none;
}

.mindmap-node,
.mindmap-node * {
  user-select: none;
  -webkit-user-select: none;
}

.mindmap-node.has-link .label {
  position: relative;
  padding-right: 26px;
}

.mindmap-node.has-link .label::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-color: currentColor;
  mask: url("assets/link_icon.svg") no-repeat center / contain;
  -webkit-mask: url("assets/link_icon.svg") no-repeat center / contain;
  opacity: 1;
}

.pill {
  border-radius: 999px;
}

.rounded {
  border-radius: 14px;
}

.rectangle {
  border-radius: 10px;
}

.ghost {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid #c9c9c3;
  background: #f7f7f5;
  cursor: pointer;
  font-weight: 500;
  color: #2f3437;
  font-family: inherit;
  box-shadow: 0 10px 18px rgba(60, 60, 67, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ghost:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 22px rgba(60, 60, 67, 0.18);
  background: #ffffff;
}

.ghost:active {
  transform: translateY(0);
  box-shadow: 0 8px 14px rgba(60, 60, 67, 0.16);
}

.ghost.danger {
  background: #fff1f0;
  border-color: #f2c7c4;
  color: #b42318;
}

@media print {
  .app-header,
  .toolbar,
  .node-menu {
    display: none !important;
  }

  body {
    background: #ffffff !important;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .canvas-wrap {
    overflow: visible;
  }

  @page {
    margin: 0;
  }

  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

.icon-btn {
  font-size: 16px;
  line-height: 1;
  padding: 8px;
  width: 34px;
  height: 34px;
}

.icon-btn .icon-glyph {
  width: 18px;
  height: 18px;
  display: block;
}


.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #2f3437;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  font-size: 13px;
}

.node-menu {
  position: absolute;
  background: #f7f7f5;
  border: 1.5px solid #cfcfc9;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 12px 24px rgba(60, 60, 67, 0.16);
  opacity: 0;
  transform: translateY(-50%);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 20;
  width: min(150px, 80vw);
}

.node-menu.show {
  opacity: 1;
  transform: translateY(-50%);
  pointer-events: auto;
}

.node-menu > button,
.node-menu .link-field .ghost {
  border: 1.5px solid #c9c9c3;
  background: #ffffff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 500;
  height: 28px;
  color: #2f3437;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.node-menu > button:hover,
.node-menu .link-field .ghost:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 18px rgba(60, 60, 67, 0.14);
  background: #ffffff;
  color: #2f3437;
}

.node-menu > button:active,
.node-menu .link-field .ghost:active {
  transform: translateY(0);
  box-shadow: 0 8px 12px rgba(60, 60, 67, 0.12);
}

.node-menu > button.danger {
  background: #fff1f0;
  border-color: #f2c7c4;
  color: #b42318;
}

.node-menu .menu-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10px;
  color: #6b6b6b;
  margin: 0;
}

.node-menu input[type="text"],
.node-menu textarea {
  border: 1.5px solid #c9c9c3;
  border-radius: 6px;
  padding: 5px 6px;
  font-size: 10px;
  height: 28px;
  font-family: inherit;
  background: #ffffff;
  color: #2f3437;
}

.node-menu textarea {
  resize: vertical;
  height: auto;
}

.node-menu .color-trigger {
  width: 22px;
  height: 22px;
}

.node-menu .file-input.icon {
  height: 28px;
  padding: 5px 6px;
  font-size: 10px;
  border-radius: 6px;
}

.node-menu .link-field input,
.node-menu .link-field .ghost {
  height: 28px;
  font-size: 10px;
}

.node-menu .link-field .ghost {
  padding: 5px 8px;
}

.node-menu input[type="range"] {
  width: 100%;
}


.toast.show {
  opacity: 1;
}

.ai-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background:
    linear-gradient(#f7f7f5, #f7f7f5) padding-box,
    linear-gradient(60deg, #8fb8ff, #a9c6ff, #ffb8c6, #ffdd7a, #ace8dc, #a9c6ff) border-box;
  background-size: 100% 100%, 240% 240%;
  background-position: 0 0, 0% 50%;
  cursor: pointer;
  font-weight: 500;
  color: #2f3437;
  font-family: inherit;
  box-shadow: 0 10px 18px rgba(60, 60, 67, 0.12);
  z-index: 10;
  min-height: 42px;
  min-width: 42px;
  isolation: isolate;
  animation: aiBorderShift 10s ease-in-out infinite;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: visible;
  transition: padding 0.28s cubic-bezier(0.22, 1, 0.36, 1), gap 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}


.ai-btn-text {
  display: inline-flex;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  transition: opacity 0.12s ease, transform 0.12s ease, max-width 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.ai-btn-close {
  position: absolute;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.ai-btn-close::before,
.ai-btn-close::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
}

.ai-btn-close::before {
  transform: rotate(45deg);
}

.ai-btn-close::after {
  transform: rotate(-45deg);
}

.ai-btn.is-open .ai-btn-text {
  opacity: 0;
  transform: translateY(-6px) scale(0.9);
  max-width: 0;
}

.ai-btn.is-open .ai-btn-close {
  opacity: 1;
  transform: scale(1);
}

.ai-btn.is-open {
  padding: 0;
  gap: 0;
}

.ai-btn.is-open {
  transition-delay: 0.12s;
}

.ai-btn.is-open .ai-btn-text {
  transition-delay: 0s, 0s, 0.12s;
}

.ai-btn.is-open .ai-btn-close {
  transition-delay: 0.26s;
}

.ai-btn:not(.is-open) {
  transition-delay: 0.14s;
}

.ai-btn:not(.is-open) .ai-btn-text {
  transition-delay: 0.28s, 0.28s, 0.14s;
}

.ai-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 22px rgba(60, 60, 67, 0.18);
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(60deg, #8fb8ff, #a9c6ff, #ffb8c6, #ffdd7a, #ace8dc, #a9c6ff) border-box;
  background-size: 100% 100%, 240% 240%;
  background-position: 0 0, 0% 50%;
  animation-duration: 4s;
}


.ai-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 14px rgba(60, 60, 67, 0.16);
}

.ai-modal[hidden] {
  display: none;
}

.ai-modal {
  position: fixed;
  right: 24px;
  bottom: 90px;
  width: min(420px, 92vw);
  height: min(72vh, 640px);
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ai-modal.open {
  opacity: 1;
  transform: translateY(0);
}

.ai-modal-card {
  position: relative;
  width: 100%;
  max-height: 100%;
  background: #f7f7f5;
  border: 1.5px solid transparent;
  background:
    linear-gradient(#f7f7f5, #f7f7f5) padding-box,
    linear-gradient(60deg, #8fb8ff, #a9c6ff, #ffb8c6, #ffdd7a, #ace8dc, #a9c6ff) border-box;
  background-size: 100% 100%, 240% 240%;
  background-position: 0 0, 0% 50%;
  animation: aiBorderShift 10s ease-in-out infinite;
  border-radius: 18px;
  box-shadow: 0 18px 32px rgba(60, 60, 67, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ai-modal.open .ai-modal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ai-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e6e6e3;
  background: #fbfbfa;
}

.ai-modal-header h3 {
  font-size: 18px;
  color: #2f3437;
  margin-bottom: 4px;
}

.ai-modal-header p {
  font-size: 12px;
  color: #6b6b6b;
}

.ai-chat {
  flex: 1;
  padding: 16px 18px;
  background: #fbfbfa;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-message.typing {
  font-style: italic;
  color: #6b6b6b;
  background: #ffffff;
}

.ai-new-message {
  align-self: center;
  margin: 6px auto 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid #c9c9c3;
  background: #ffffff;
  font-size: 11px;
  color: #2f3437;
  box-shadow: 0 8px 14px rgba(60, 60, 67, 0.08);
  cursor: pointer;
}

.ai-new-message:active {
  transform: translateY(1px);
}

.ai-message {
  max-width: 72%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid #c9c9c3;
  font-size: 13px;
  color: #2f3437;
  background: #ffffff;
  box-shadow: 0 8px 14px rgba(60, 60, 67, 0.08);
  white-space: pre-wrap;
  animation: aiMessageIn 0.18s ease-out;
  transform-origin: top left;
  will-change: transform, opacity;
}

.ai-message.user {
  align-self: flex-end;
  background: #f7f7f5;
}

@keyframes aiMessageIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ai-message.assistant {
  align-self: flex-start;
}

.ai-controls {
  padding: 12px 16px;
  border-top: 1px solid #e6e6e3;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f7f5;
}

.ai-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.ai-controls .file-input.icon {
  column-gap: 6px;
  padding: 5px 8px;
  font-size: 10px;
}

.ai-link-input {
  flex: 1 1 240px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.ai-link-input input {
  flex: 1 1 auto;
  border: 1.5px solid #c9c9c3;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 11px;
  font-family: inherit;
  background: #ffffff;
  color: #2f3437;
}

.ai-link-input .ghost {
  padding: 6px 10px;
  font-size: 11px;
}

.ai-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1.5px solid #c9c9c3;
  background: #ffffff;
  font-size: 11px;
  color: #2f3437;
}

.ai-chip button {
  border: none;
  background: transparent;
  color: #6b6b6b;
  cursor: pointer;
  font-size: 12px;
}

.ai-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: #6b6b6b;
}

.ai-field textarea {
  border: 1.5px solid #c9c9c3;
  border-radius: 10px;
  padding: 7px 9px;
  font-size: 12px;
  font-family: inherit;
  background: #ffffff;
  color: #2f3437;
  resize: vertical;
}

.ai-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-detail {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #6b6b6b;
}

.ai-detail-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1.5px solid #c9c9c3;
  background: #ffffff;
}

.ai-detail-arrow {
  width: auto;
  height: auto;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 16px;
  color: #2f3437;
  box-shadow: none;
  transform: none;
}

.ai-detail-arrow:disabled {
  color: #b7b7b2;
  cursor: not-allowed;
  opacity: 0.6;
}

.ai-detail-value {
  min-width: 70px;
  text-align: center;
  font-weight: 400;
  color: #2f3437;
  text-transform: capitalize;
  transition: opacity 0.16s ease;
  display: inline-block;
}

.ai-detail-value.is-changing {
  opacity: 0;
}

.ai-action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@keyframes aiBorderShift {
  0% {
    background-position: 0 0, 0% 50%;
  }
  50% {
    background-position: 0 0, 100% 50%;
  }
  100% {
    background-position: 0 0, 0% 50%;
  }
}

.dashboard {
  padding: 24px 28px 48px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.dashboard-header h2 {
  font-size: 16px;
  color: #2f3437;
}

.dashboard-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.dashboard-card {
  background: #ffffff;
  border: 1.5px solid #c9c9c3;
  border-radius: 12px;
  padding: 18px;
  display: grid;
  gap: 10px;
}


.dashboard-title {
  border: 1.5px solid #c9c9c3;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 14px;
  font-family: inherit;
  background: #f7f7f5;
  color: #2f3437;
}

.dashboard-meta {
  font-size: 12px;
  color: #6b6b6b;
}

.dashboard-actions {
  display: flex;
  gap: 8px;
}

.dashboard-empty {
  font-size: 13px;
  color: #6b6b6b;
  padding: 24px;
  border: 1.5px dashed #c9c9c3;
  border-radius: 12px;
  background: #fbfbfa;
}

.login-body {
  background-color: #fbfbfa;
  background-image: none;
  overflow: auto;
  user-select: text;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 48px;
  align-items: stretch;
  padding: 48px;
  min-height: 100vh;
}

.login-media {
  border: 1.5px solid #c9c9c3;
  border-radius: 18px;
  background: #f7f7f5;
  min-height: calc(100vh - 96px);
  height: 100%;
  box-shadow: 0 16px 28px rgba(60, 60, 67, 0.12);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
  padding: 32px;
}

.login-media-placeholder {
  color: #ffffff;
  font-size: 38px;
  font-weight: 700;
  line-height: 1.3;
  max-width: 500px;
  position: relative;
  z-index: 2;
}

.login-media::before {
  content: "";
  position: absolute;
  inset: -30%;
  background: linear-gradient(
    120deg,
    rgba(120, 170, 255, 0.92),
    rgba(255, 126, 170, 0.9),
    rgba(255, 200, 88, 0.92),
    rgba(120, 224, 206, 0.92),
    rgba(120, 170, 255, 0.92)
  );
  background-size: 200% 200%;
  animation: gradientShift 12s ease-in-out infinite;
  z-index: 0;
}

.login-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.35), transparent 55%),
    radial-gradient(circle at 80% 0%, rgba(255, 255, 255, 0.25), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.2), transparent 55%);
  z-index: 1;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.login-panel {
  max-width: 420px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0 auto;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.login-brand .app-logo {
  width: 70px;
  height: 70px;
}

.login-brand h1 {
  font-size: 41px;
  color: #2f3437;
}

.login-title {
  font-size: 36px;
  color: #2f3437;
  margin-bottom: 10px;
}

.login-subtitle {
  font-size: 16px;
  color: #6b6b6b;
  margin-bottom: 26px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #6b6b6b;
}

.login-field input {
  border: 1.5px solid #c9c9c3;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #ffffff;
  color: #2f3437;
  width: 100%;
}

.password-field {
  position: relative;
  width: 100%;
}

.password-field input {
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #6b6b6b;
  cursor: pointer;
  padding: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  color: #2f3437;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}

.password-toggle .eye-shape {
  opacity: 1;
}

.password-toggle .eye-slash {
  opacity: 1;
  transform: scale(1);
  transform-origin: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.password-toggle.is-visible .eye-slash {
  opacity: 0;
  transform: scale(0.9);
}

.login-field[hidden] {
  display: none;
}

.login-forgot {
  display: flex;
  justify-content: flex-end;
}

.login-btn {
  width: 100%;
  border-radius: 12px;
  border: 1.5px solid #c9c9c3;
  background: #f7f7f5;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  color: #2f3437;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 10px 18px rgba(60, 60, 67, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 22px rgba(60, 60, 67, 0.18);
  background: #ffffff;
}

.login-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 14px rgba(60, 60, 67, 0.16);
}

.login-note {
  font-size: 13px;
  color: #6b6b6b;
  min-height: 16px;
}

.login-note.error {
  color: #b42318;
}

.login-switch {
  display: flex;
  gap: 6px;
  justify-content: center;
  font-size: 13px;
  color: #6b6b6b;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 12px;
  color: #6b6b6b;
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #e2e2de;
}

.login-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.google-mark {
  width: 18px;
  height: 18px;
  display: inline-flex;
}

.google-mark svg {
  width: 18px;
  height: 18px;
  display: block;
}

@media (max-width: 960px) {
  .login-layout {
    grid-template-columns: 1fr;
    padding: 32px;
  }

  .login-media {
    min-height: 260px;
    height: auto;
  }
}

.profile-menu {
  position: relative;
  display: inline-flex;
}

.profile-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid #c9c9c3;
  background: #f7f7f5;
  color: #2f3437;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.profile-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 18px rgba(60, 60, 67, 0.14);
  background: #ffffff;
}

.profile-btn.is-signed-in {
  background: #2f3437;
  border-color: #2f3437;
  color: #ffffff;
}

.profile-badge {
  font-size: 14px;
  line-height: 1;
  text-transform: uppercase;
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #ffffff;
  border: 1.5px solid #c9c9c3;
  border-radius: 12px;
  padding: 12px;
  min-width: 200px;
  box-shadow: 0 14px 26px rgba(60, 60, 67, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 40;
}

.profile-menu.open .profile-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.profile-welcome {
  font-size: 13px;
  font-weight: 600;
  color: #2f3437;
}

.profile-email {
  font-size: 12px;
  color: #6b6b6b;
}

.profile-action {
  border: 1.5px solid #c9c9c3;
  background: #f7f7f5;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  color: #2f3437;
  cursor: pointer;
  text-align: left;
}

.profile-action:hover {
  background: #ffffff;
}

.modal[hidden] {
  display: none;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.45);
}

.modal-card {
  position: relative;
  width: min(420px, 92vw);
  background: #ffffff;
  border-radius: 14px;
  border: 1.5px solid #c9c9c3;
  box-shadow: 0 18px 32px rgba(60, 60, 67, 0.2);
  padding: 18px;
  z-index: 1;
}

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

.modal-header h3 {
  font-size: 16px;
  color: #2f3437;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #6b6b6b;
}

.modal-field input {
  border: 1.5px solid #c9c9c3;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: #ffffff;
  color: #2f3437;
}

.modal-note {
  font-size: 12px;
  color: #6b6b6b;
  min-height: 16px;
}

.modal-note.error {
  color: #b42318;
}

.modal-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #6b6b6b;
  font-size: 12px;
}

.modal-divider::before,
.modal-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #e2e2de;
}

.modal-forgot {
  display: flex;
  justify-content: flex-end;
}

.text-btn {
  border: none;
  background: transparent;
  color: #2f3437;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}

.text-btn:hover {
  text-decoration: underline;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

  .toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
    border-right: none;
    border-bottom: 1px solid #e3e4ef;
  }

  .section {
    flex: 1 1 200px;
  }
}
