/* Interaction fixes layered after main.css.
   Keeps workspace text editing / Ask AI available even after drawing mode is enabled. */
.figma-canvas .drawing-layer {
  z-index: 1;
}

.figma-canvas .drawing-hitbox {
  z-index: 1;
}

.figma-canvas .workspace-block,
.figma-canvas .workspace-block-static {
  z-index: 2;
  pointer-events: auto;
}

.figma-canvas .workspace-block:hover,
.figma-canvas .workspace-block:focus-within,
.figma-canvas .workspace-block-static:hover,
.figma-canvas .workspace-block-static:focus-within {
  z-index: 1001;
}

.figma-canvas .floating-tools,
.figma-canvas .floating-tools.is-visible {
  z-index: 1200;
}

.drawing-layer.is-active + .workspace-block,
.drawing-layer.is-active ~ .workspace-block,
.drawing-layer.is-active ~ .workspace-block-static {
  pointer-events: auto;
}

.workspace-block textarea::selection,
.workspace-block input::selection,
.workspace-block [contenteditable]::selection,
.workspace-block-static textarea::selection,
.workspace-block-static input::selection,
.workspace-block-static [contenteditable]::selection {
  background: hsl(var(--primary) / 0.22);
}

/* v46-style open workspace restoration: large freeform canvas with lightweight cards.
   These overrides intentionally keep moving on the grip only, while text fields remain selectable/editable. */
.canvas-dots {
  min-height: calc(100vh - 180px);
  padding: 0 !important;
  overflow: auto !important;
  border-color: hsl(var(--border) / 0.5);
}

.workspace-dock {
  position: sticky !important;
  top: 16px;
  left: 16px;
  margin: 16px 0 0 16px !important;
  z-index: 40;
}

.figma-canvas {
  min-width: 1280px !important;
  min-height: 1220px !important;
  padding: 0;
  touch-action: auto;
  isolation: isolate;
}

.workspace-block {
  resize: both;
  overflow: visible !important;
  height: auto !important;
  padding-top: 30px !important;
  padding-right: 18px !important;
  padding-bottom: 18px !important;
  background-color: hsl(var(--card) / 0.64);
  background-image: none !important;
  border: 1px solid hsl(var(--border) / 0.68);
  box-shadow: 0 12px 34px hsl(224 26% 12% / 0.07), inset 0 1px 0 hsl(0 0% 100% / 0.58);
  user-select: auto;
  -webkit-user-select: auto;
}

.workspace-block:hover,
.workspace-block:focus-within {
  background-image: none !important;
}

.workspace-block::-webkit-resizer {
  background: transparent;
  border: 0;
}

.workspace-block-static {
  overflow: visible !important;
  height: auto !important;
  padding-top: 30px !important;
  background-image: none !important;
}

.workspace-block textarea,
.workspace-block input,
.workspace-block [contenteditable],
.workspace-block-static textarea,
.workspace-block-static input,
.workspace-block-static [contenteditable] {
  user-select: text !important;
  -webkit-user-select: text !important;
  touch-action: auto !important;
  pointer-events: auto;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.workspace-block textarea {
  min-height: 80px;
}

.canvas-block-chrome {
  position: absolute;
  top: 6px;
  left: 8px;
  right: 8px;
  height: 22px;
  z-index: 5;
  pointer-events: none;
}

.canvas-block-chrome > * {
  pointer-events: auto;
}

.drag-handle {
  width: 24px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: hsl(var(--card) / 0.72);
}

.workspace-block::before,
.workspace-block::after,
.workspace-block-static::before,
.workspace-block-static::after {
  content: none !important;
  display: none !important;
  background: none !important;
}

.workspace-block .floating-tools,
.workspace-block-static .floating-tools {
  position: absolute !important;
  top: 6px !important;
  bottom: auto !important;
  left: 42px !important;
  z-index: 5000 !important;
  transform: translateY(0);
  width: max-content;
  max-width: min(820px, calc(100vw - 64px));
  white-space: normal;
  overflow: visible !important;
  opacity: 0;
  pointer-events: none;
}

.workspace-block .floating-tools.is-visible,
.workspace-block-static .floating-tools.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.floating-tools > button,
.floating-tools > label,
.floating-tools > select,
.workspace-extra-tool {
  flex: 0 0 auto;
}

.floating-tools label[title="Color"] {
  position: relative !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden;
  border-radius: 999px !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}

.floating-tools label[title="Color"] > div {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  transform: translate(-50%, -50%) !important;
  pointer-events: none !important;
}

.floating-tools label[title="Color"] input[type="color"] {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.workspace-extra-tool {
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: inline-grid !important;
  place-items: center;
  padding: 0 !important;
  border-radius: 10px;
  color: hsl(var(--muted-foreground));
}

button.workspace-extra-tool:hover {
  background: hsl(var(--muted));
}

.floating-tools .ask-ai-tool,
.floating-tools > button:first-of-type {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid hsl(0 0% 100% / .74);
  color: hsl(258 12% 45%);
  background: radial-gradient(circle at 22% 12%, hsl(0 0% 100% / .98), hsl(255 80% 97% / .78) 46%, hsl(210 90% 96% / .66));
  box-shadow: 0 8px 20px hsl(224 26% 12% / .08), 0 0 20px hsl(var(--primary) / .045), inset 0 1px 2px hsl(0 0% 100% / .96), inset 0 -8px 16px hsl(252 30% 72% / .10);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), color var(--transition-fast), border-color var(--transition-fast);
}

.floating-tools .ask-ai-tool::before,
.floating-tools > button:first-of-type::before {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: inherit;
  background: radial-gradient(circle at 28% 20%, hsl(var(--secondary) / .18), transparent 38%), radial-gradient(circle at 86% 72%, hsl(var(--primary) / .16), transparent 44%);
  filter: blur(14px);
  opacity: .42;
  z-index: -1;
  transition: opacity var(--transition-fast), transform var(--transition-smooth);
}

.floating-tools .ask-ai-tool:hover,
.floating-tools > button:first-of-type:hover {
  transform: translateY(-2px);
  color: hsl(252 16% 36%);
  border-color: hsl(0 0% 100% / .92);
  box-shadow: 0 14px 34px hsl(224 26% 12% / .12), 0 0 34px hsl(var(--primary) / .10), inset 0 1px 3px hsl(0 0% 100% / .98), inset 0 -10px 18px hsl(252 38% 70% / .13);
}

.floating-tools .ask-ai-tool:hover::before,
.floating-tools > button:first-of-type:hover::before {
  opacity: 1;
  transform: scale(1.06);
}

.floating-tools > .soft-card,
.ai-inline-panel {
  width: min(640px, calc(100vw - 72px)) !important;
  background: hsl(var(--card) / .985) !important;
}

.ai-inline-panel {
  z-index: 8000 !important;
  padding: 12px !important;
}

.calio-ai-prompt-form {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 46px 54px;
  grid-template-areas: "prompt task send";
  align-items: center;
  gap: 10px !important;
  width: 100%;
}

.ai-task-menu-wrap {
  grid-area: task;
  position: relative;
}

.calio-ai-task-trigger {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  box-shadow: none;
  cursor: pointer;
}

.calio-ai-task-trigger:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--muted) / .55);
  border-color: hsl(var(--border));
  box-shadow: none;
}

.ai-task-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 250px;
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  box-shadow: 0 14px 38px hsl(224 26% 12% / .12);
  backdrop-filter: blur(10px);
  z-index: 9000;
}

.ai-task-menu-title {
  padding: 6px 8px 7px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.ai-task-item {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  color: hsl(var(--foreground));
  transition: background var(--transition-fast), color var(--transition-fast);
}

.ai-task-item.with-separator {
  margin-top: 4px;
}

.ai-task-item.with-separator::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: -2px;
  height: 1px;
  background: hsl(var(--border));
}

.ai-task-item:hover {
  background: hsl(var(--muted) / .55);
  transform: none;
  box-shadow: none;
}

.ai-task-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: hsl(var(--muted-foreground));
  background: transparent;
}

.ai-task-copy {
  min-width: 0;
  display: block;
}

.ai-task-copy strong {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.ai-task-copy small {
  display: none;
}

.calio-ai-prompt-form input {
  grid-area: prompt;
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 46px;
  order: 0;
  font-size: 14px;
  border-radius: 16px !important;
  background: hsl(var(--card) / .92) !important;
  box-shadow: inset 0 1px 0 hsl(0 0% 100% / .68), 0 8px 20px hsl(224 26% 12% / .045);
}

.calio-ai-prompt-form .calio-ai-send {
  grid-area: send;
  width: 54px;
  min-height: 46px;
  border-radius: 16px;
  order: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid hsl(0 0% 100% / .74);
  color: hsl(258 12% 45%) !important;
  font-weight: 800;
  background: radial-gradient(circle at 22% 12%, hsl(0 0% 100% / .98), hsl(255 80% 97% / .78) 46%, hsl(210 90% 96% / .66));
  box-shadow: 0 10px 24px hsl(224 26% 12% / .09), 0 0 24px hsl(var(--primary) / .06), inset 0 1px 2px hsl(0 0% 100% / .96), inset 0 -8px 16px hsl(252 30% 72% / .10);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), color var(--transition-fast), border-color var(--transition-fast);
}

.calio-ai-prompt-form .calio-ai-send::before {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: inherit;
  background: radial-gradient(circle at 28% 20%, hsl(var(--secondary) / .18), transparent 38%), radial-gradient(circle at 86% 72%, hsl(var(--primary) / .16), transparent 44%);
  filter: blur(14px);
  opacity: .5;
  z-index: -1;
}

.calio-ai-prompt-form .calio-ai-send:hover:not(:disabled) {
  transform: translateY(-2px);
  color: hsl(252 16% 36%) !important;
  border-color: hsl(0 0% 100% / .92);
  box-shadow: 0 16px 36px hsl(224 26% 12% / .13), 0 0 38px hsl(var(--primary) / .11), inset 0 1px 3px hsl(0 0% 100% / .98), inset 0 -10px 18px hsl(252 38% 70% / .13);
}

.dark .ai-task-menu,
.dark .calio-ai-task-trigger {
  border-color: hsl(var(--border) / .82);
  box-shadow: 0 14px 38px hsl(0 0% 0% / .28);
}

@media (max-width: 640px) {
  .calio-ai-prompt-form {
    grid-template-columns: 1fr 46px;
    grid-template-areas: "prompt task" "send send";
  }
  .calio-ai-prompt-form .calio-ai-send {
    width: 100%;
  }
  .ai-task-menu {
    right: -56px;
    width: min(250px, calc(100vw - 42px));
  }
}

.workspace-emoji-panel {
  z-index: 7000 !important;
  width: max-content;
  white-space: normal;
}

.drawing-hitbox {
  pointer-events: auto;
}

.drawing-layer.is-active ~ .workspace-block textarea,
.drawing-layer.is-active ~ .workspace-block input {
  pointer-events: auto;
}

/* Screenshot-inspired compact composer for client notes/tasks: white pill, leading checkbox, and soft action buttons. */
aside .soft-card form.mt-3.flex.gap-2 {
  position: relative;
  align-items: center;
  gap: 8px !important;
  min-height: 54px;
  padding: 8px 8px 8px 42px;
  border-radius: 18px;
  background: hsl(var(--card) / .94);
  border: 1px solid hsl(0 0% 100% / .72);
  box-shadow: 0 14px 34px hsl(224 26% 12% / .10), inset 0 1px 2px hsl(0 0% 100% / .92);
}

aside .soft-card form.mt-3.flex.gap-2::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  border-radius: 7px;
  background: hsl(var(--muted) / .72);
  box-shadow: inset 0 1px 0 hsl(0 0% 100% / .82), 0 2px 8px hsl(224 26% 12% / .05);
}

aside .soft-card form.mt-3.flex.gap-2:focus-within {
  border-color: hsl(var(--primary) / .28);
  box-shadow: 0 18px 44px hsl(var(--primary) / .10), 0 14px 34px hsl(224 26% 12% / .08), inset 0 1px 2px hsl(0 0% 100% / .94);
}

aside .soft-card form.mt-3.flex.gap-2 input {
  min-width: 0;
  height: 38px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 4px !important;
  outline: none;
}

aside .soft-card form.mt-3.flex.gap-2 input::placeholder {
  color: hsl(var(--muted-foreground) / .72);
}

aside .soft-card form.mt-3.flex.gap-2 button {
  min-width: 44px;
  height: 38px;
  border-radius: 14px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 14px !important;
  color: hsl(258 12% 45%) !important;
  border: 1px solid hsl(0 0% 100% / .74);
  background: radial-gradient(circle at 22% 12%, hsl(0 0% 100% / .98), hsl(255 80% 97% / .78) 46%, hsl(210 90% 96% / .66)) !important;
  box-shadow: 0 10px 24px hsl(224 26% 12% / .08), 0 0 22px hsl(var(--primary) / .055), inset 0 1px 2px hsl(0 0% 100% / .96), inset 0 -8px 16px hsl(252 30% 72% / .10) !important;
}

aside .soft-card form.mt-3.flex.gap-2 button:hover:not(:disabled) {
  transform: translateY(-2px);
  color: hsl(252 16% 36%) !important;
  box-shadow: 0 16px 36px hsl(224 26% 12% / .13), 0 0 38px hsl(var(--primary) / .11), inset 0 1px 3px hsl(0 0% 100% / .98), inset 0 -10px 18px hsl(252 38% 70% / .13) !important;
}

.dark aside .soft-card form.mt-3.flex.gap-2 {
  border-color: hsl(var(--border) / .78);
  background: hsl(var(--card) / .88);
}

.project-stages-card {
  overflow: hidden;
}

.project-stages-progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 750;
  color: hsl(var(--secondary));
  background: hsl(var(--secondary) / .10);
}

.project-stage-list {
  position: relative;
  display: grid;
  gap: 10px;
}

.project-stage-list::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, hsl(var(--secondary) / .48), hsl(var(--border) / .70));
}

.project-stage-item {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr 28px;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 9px 8px;
  border-radius: 18px;
  background: hsl(var(--card) / .72);
  border: 1px solid hsl(var(--border) / .66);
  box-shadow: 0 8px 18px hsl(224 26% 12% / .045);
  cursor: grab;
  transform: translateZ(0);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
}

.project-stage-item:active {
  cursor: grabbing;
}

.project-stage-item[draggable="true"] {
  -webkit-user-drag: element;
}

.project-stage-item.opacity-40 {
  opacity: .62 !important;
  transform: scale(.985);
  border-color: hsl(var(--primary) / .26);
  box-shadow: 0 14px 30px hsl(var(--primary) / .08);
}

.project-stage-item input,
.project-stage-item button {
  cursor: auto;
}

.project-stage-marker {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  z-index: 1;
}

.project-stage-item.is-done .project-stage-marker {
  color: white;
  border-color: transparent;
  background: hsl(var(--secondary) / .72);
}

.project-stage-copy {
  min-width: 0;
}

.project-stage-index {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: hsl(var(--muted-foreground) / .72);
}

.project-stage-title {
  width: 100%;
  margin-top: 2px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  color: hsl(var(--foreground));
}

.project-stage-item.is-done .project-stage-title {
  color: hsl(var(--muted-foreground));
  text-decoration: line-through;
}

.project-stage-delete {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: hsl(var(--muted-foreground) / .7);
}

.project-stage-delete:hover {
  color: hsl(var(--destructive));
  background: hsl(var(--destructive) / .08);
}

.project-stage-form {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid hsl(var(--border) / .72);
  background: hsl(var(--card) / .80);
}

.project-stage-form::before {
  display: none !important;
}

.project-stage-form-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / .7);
}

.project-stage-form input {
  min-width: 0;
  height: 38px;
  border: 0 !important;
  outline: none;
  background: transparent !important;
  padding: 0 2px !important;
  font-size: 13px;
}

.project-stage-form button {
  height: 38px;
  border-radius: 12px !important;
}
