:root {
  color-scheme: dark;
  --bg-0: #0d0f12;
  --bg-1: #13161b;
  --bg-2: #1a1f25;
  --surface: rgba(17, 20, 24, 0.92);
  --surface-strong: #1b2027;
  --ink: #e6e8ec;
  --muted: #9aa0a6;
  --accent: #c7ccd4;
  --accent-soft: rgba(199, 204, 212, 0.2);
  --card: #1b1f24;
  --card-border: rgba(255, 255, 255, 0.08);
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
  --card-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
  --font-display: "Aptos", "Segoe UI Variable Display", "Segoe UI", "Calibri",
    "Trebuchet MS", sans-serif;
  --font-body: "Aptos", "Segoe UI Variable", "Segoe UI", "Calibri", "Trebuchet MS",
    sans-serif;
  --toolbar-width: 90px;
  --nav-height: 68px;
  --radius: 2px;
  --grid-size: 16px;
  --grid-color: rgba(255, 255, 255, 0.04);
  --grid-dot-size: 1.2px;
  --swatch-size: 7px;
  --swatch-gap: 2px;
  --content-font-size: 14px;
  --button-bg: rgba(20, 24, 32, 0.8);
  --button-border: rgba(255, 255, 255, 0.1);
  --button-hover-bg: rgba(28, 32, 40, 0.9);
  --button-hover-border: rgba(199, 204, 212, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: radial-gradient(circle at top, #1c2026, var(--bg-0) 60%),
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.05), transparent 45%),
    linear-gradient(155deg, var(--bg-1), var(--bg-2));
  overflow: hidden;
}

#clipboard-catcher {
  position: fixed;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  resize: none;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg-0: #f4f6f8;
  --bg-1: #eef1f4;
  --bg-2: #e4e9ee;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --ink: #1c2430;
  --muted: #5b6570;
  --accent: #2c3545;
  --accent-soft: rgba(44, 53, 69, 0.16);
  --card: #ffffff;
  --card-border: rgba(0, 0, 0, 0.08);
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.12);
  --card-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  --grid-color: rgba(0, 0, 0, 0.06);
  --button-bg: rgba(255, 255, 255, 0.8);
  --button-border: rgba(0, 0, 0, 0.1);
  --button-hover-bg: rgba(244, 246, 248, 0.95);
  --button-hover-border: rgba(44, 53, 69, 0.3);
}

body[data-theme="light"] .nav-bar {
  background: linear-gradient(135deg,
      rgba(250, 251, 253, 0.98),
      rgba(236, 240, 245, 0.96));
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.12);
}

body[data-theme="light"] #toolbar {
  background: rgba(246, 249, 252, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 12px 0 24px rgba(0, 0, 0, 0.12);
}

body[data-theme="light"] #breadcrumbs button,
body[data-theme="light"] #board-title-input {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body[data-theme="light"] #help-panel,
body[data-theme="light"] .settings-panel {
  background: rgba(250, 251, 253, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.12);
}

body[data-theme="light"] .text-panel,
body[data-theme="light"] .context-menu {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

body[data-theme="light"] .context-menu-item:hover {
  border-color: rgba(44, 53, 69, 0.25);
  background: rgba(44, 53, 69, 0.08);
}

body[data-theme="light"] #toast {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--muted);
}

body[data-theme="light"] .tool-input,
body[data-theme="light"] .color-input {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

body[data-theme="light"] .card.column {
  background: #f6f8fb;
  border-color: rgba(0, 0, 0, 0.08);
}

body[data-theme="light"] .card.frame {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.12);
}

body[data-theme="light"] .board-cover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.12);
}

body[data-theme="light"] .board-cover-placeholder {
  background: rgba(240, 243, 247, 0.9);
  color: rgba(44, 53, 69, 0.6);
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

#app {
  height: 100%;
}

.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  min-height: var(--nav-height);
  border-radius: 0;
  background: linear-gradient(135deg,
      rgba(20, 24, 30, 0.96),
      rgba(12, 15, 20, 0.96));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.logo {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}

#breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

#breadcrumbs button {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius);
  background: rgba(12, 15, 20, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

#breadcrumbs button[aria-current="page"] {
  border-color: rgba(199, 204, 212, 0.6);
  background: var(--accent-soft);
}

#breadcrumbs .crumb-sep {
  color: rgba(255, 255, 255, 0.3);
  padding: 0 2px;
}

#board-title-display,
#board-title-input {
  min-width: 200px;
  max-width: 320px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#board-title-display {
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
}

#board-title-display.is-locked {
  cursor: default;
  color: var(--muted);
}

#board-title-input {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 15, 20, 0.65);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: var(--radius);
}

#board-title-input:focus {
  outline: 2px solid rgba(199, 204, 212, 0.45);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  min-width: 0;
}

.nav-icon-button {
  padding: 6px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button,
.button {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.3px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease,
    background 0.12s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--button-hover-border);
  background: var(--button-hover-bg);
}

button:active {
  transform: translateY(0);
}

#zoom-level {
  font-size: 12px;
  color: var(--muted);
  padding: 0 4px;
}

#toolbar {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  bottom: 0;
  width: var(--toolbar-width);
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px 8px;
  border-radius: 0;
  background: rgba(14, 17, 22, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 12px 0 24px rgba(0, 0, 0, 0.35);
  overflow: auto;
}

.tool-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-group[data-group="text"] {
  position: relative;
}

.tool-group[data-group="canvas"] {
  --swatch-size: 16px;
  --swatch-gap: 3px;
}

.tool-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  text-align: center;
}

.tool-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.tool-input {
  width: 100%;
  padding: 6px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 12, 16, 0.6);
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0.3px;
}

.tool-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tool-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding: 6px 4px;
  font-size: 10px;
  line-height: 1.1;
  text-align: center;
}

.tool-button.text-panel-toggle[aria-pressed="true"] {
  border-color: rgba(199, 204, 212, 0.6);
  background: rgba(199, 204, 212, 0.12);
  color: var(--ink);
}

.text-panel {
  position: fixed;
  left: 0;
  top: 0;
  width: min(260px, calc(100vw - 24px));
  max-height: min(75vh, 480px);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(18, 22, 28, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  overflow: auto;
  z-index: 20;
  --swatch-size: 16px;
  --swatch-gap: 3px;
}

.text-panel[hidden] {
  display: none;
}

.context-menu {
  position: fixed;
  left: 0;
  top: 0;
  min-width: 190px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(18, 22, 28, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
  z-index: 30;
}

.context-menu[hidden] {
  display: none;
}

.context-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0.2px;
  text-align: left;
  cursor: pointer;
}

.context-menu-item:hover {
  border-color: rgba(199, 204, 212, 0.4);
  background: rgba(199, 204, 212, 0.1);
}

.context-menu-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.context-menu-item.is-danger {
  color: #f06b6b;
}

.context-menu-item[aria-pressed="true"]::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.context-menu-separator {
  height: 1px;
  margin: 4px 2px;
  background: rgba(255, 255, 255, 0.08);
}

.context-menu-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 2px;
}

.context-menu-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.context-swatch-row {
  display: grid;
  grid-template-columns: repeat(4, 16px);
  gap: 3px;
  align-items: center;
}

.context-menu .swatch {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  border-radius: 5px;
}

.text-panel-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.text-panel-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.text-panel .tool-row,
.text-panel .segmented {
  grid-template-columns: repeat(auto-fit, minmax(32px, 1fr));
  gap: 6px;
}

.text-panel .tool-button {
  padding: 6px;
  min-height: 28px;
  gap: 2px;
}

.text-panel .tool-icon {
  width: 16px;
  height: 16px;
}

.text-panel .swatch-row {
  grid-template-columns: repeat(6, var(--swatch-size));
  gap: var(--swatch-gap);
  grid-auto-rows: var(--swatch-size);
}

.text-panel .color-input {
  height: 24px;
  border-radius: 6px;
}

.toolbar-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(20, 24, 30, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  pointer-events: none;
  z-index: 20;
  transform: translate(-9999px, -9999px);
}

.tool-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-icon .icon-fill {
  fill: currentColor;
  stroke: none;
}

.line-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 12px;
}

.line-icon::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transform: translateY(-50%);
}

.line-icon.line-medium::before {
  height: 3px;
}

.line-icon.line-thick::before {
  height: 4px;
}

.line-icon.line-dashed::before {
  height: 0;
  background: none;
  border-top: 2px dashed currentColor;
}

.line-icon.line-start::after {
  content: "";
  position: absolute;
  left: -1px;
  top: 50%;
  border-width: 4px 5px 4px 0;
  border-style: solid;
  border-color: transparent currentColor transparent transparent;
  transform: translateY(-50%);
}

.line-icon.line-end::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  border-width: 4px 0 4px 5px;
  border-style: solid;
  border-color: transparent transparent transparent currentColor;
  transform: translateY(-50%);
}

.tool-text {
  white-space: normal;
}

.task-priority-chip {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.tool-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.tool-row .tool-button,
.segmented .tool-button {
  padding: 6px 4px;
}

.tool-row .tool-text,
.segmented .tool-text {
  display: none;
}

.segmented button[aria-pressed="true"] {
  border-color: rgba(199, 204, 212, 0.6);
  background: var(--accent-soft);
  color: var(--ink);
}

.tool-group[data-group="board"] .tool-button[aria-pressed="true"] {
  border-color: rgba(199, 204, 212, 0.6);
  background: rgba(199, 204, 212, 0.12);
  color: var(--ink);
}

.tool-group[data-group="connector"] .tool-button[aria-pressed="true"] {
  border-color: rgba(199, 204, 212, 0.6);
  background: rgba(199, 204, 212, 0.12);
  color: var(--ink);
}

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

.color-section.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.swatch-row {
  display: grid;
  grid-template-columns: repeat(4, var(--swatch-size));
  gap: var(--swatch-gap);
  grid-auto-rows: var(--swatch-size);
  justify-content: start;
}

.swatch {
  display: block;
  width: var(--swatch-size);
  height: var(--swatch-size);
  padding: 0;
  min-width: var(--swatch-size);
  min-height: var(--swatch-size);
  box-sizing: border-box;
  appearance: none;
  font-size: 0;
  line-height: 0;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--swatch-color);
  cursor: pointer;
}

.swatch.is-active {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.swatch-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.custom-swatch {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.color-input {
  width: 100%;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  padding: 0;
}

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

.color-input::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

.color-input::-moz-color-swatch {
  border: none;
  border-radius: 6px;
}

.custom-swatch.is-active .color-input {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#zoom-level {
  display: inline-block;
}

.tool-group[hidden] {
  display: none;
}

#workspace {
  position: relative;
  height: 100%;
  padding-top: var(--nav-height);
  padding-left: var(--toolbar-width);
}

#viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: default;
  background-color: var(--board-bg, var(--bg-1));
  background-image: radial-gradient(circle,
      var(--grid-color) var(--grid-dot-size),
      transparent calc(var(--grid-dot-size) + 0.4px));
  background-size: var(--grid-size) var(--grid-size);
}

body[data-grid="off"] #viewport {
  background-image: none;
}

#viewport.is-panning {
  cursor: grabbing;
}

#board {
  position: absolute;
  left: 0;
  top: 0;
  width: 8000px;
  height: 6000px;
  transform-origin: 0 0;
  background: transparent;
}

#connections {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  z-index: 0;
}

.connections-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.connector-path {
  pointer-events: stroke;
}

.connector-arrow {
  pointer-events: auto;
}

.connector-arrow-start {
  pointer-events: auto;
  cursor: grab;
}

.connector-arrow-end {
  cursor: grab;
}

.connector-arrow-shape {
  transform-origin: 50% 50%;
  transform-box: fill-box;
  transform: scale(1);
  transition: transform 0.18s ease;
}

.connector.is-end-hovered .connector-arrow-end .connector-arrow-shape {
  transform: scale(1.7);
}

.connector.is-preview .connector-arrow-shape {
  opacity: 0.55;
}

.connector-control {
  fill: #ffffff;
  stroke: rgba(148, 156, 168, 0.7);
  stroke-width: 1.5px;
  opacity: 0;
  pointer-events: none;
  cursor: move;
  transition: opacity 0.15s ease;
}

.connector.is-hovered .connector-control {
  opacity: 1;
  pointer-events: auto;
}

.connector.is-hovered .connector-path {
  opacity: 0.85;
}

.connector.is-preview .connector-path {
  opacity: 0.55;
}

.connector.is-end-hovered .connector-path {
  cursor: crosshair;
}

#connection-labels {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.connector-label {
  position: absolute;
  min-width: 40px;
  padding: 4px 6px;
  font-size: 11px;
  color: var(--ink);
  background: rgba(16, 20, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  pointer-events: auto;
  outline: none;
  white-space: nowrap;
  cursor: text;
}

.connector-label.is-selected {
  border-color: rgba(199, 204, 212, 0.6);
}

#selection-box {
  position: absolute;
  border: 1px dashed rgba(199, 204, 212, 0.7);
  background: rgba(199, 204, 212, 0.14);
  pointer-events: none;
  z-index: 6;
}

.card {
  position: absolute;
  min-width: 160px;
  min-height: 48px;
  border-radius: var(--radius);
  background: var(--card-bg, var(--card));
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  color: var(--ink);
  overflow: visible;
  transition: box-shadow 0.15s ease, transform 0.12s ease;
  cursor: grab;
}

.card.is-selected {
  box-shadow: 0 0 0 2px rgba(199, 204, 212, 0.6), var(--card-shadow);
}

.card.line {
  min-width: 64px;
  min-height: 16px;
  background: transparent;
  border: none;
  box-shadow: none;
}

.card.line.is-selected {
  box-shadow: 0 0 0 1px rgba(199, 204, 212, 0.55);
}

.connector-handle {
  position: absolute;
  top: -4.5px;
  right: -4.5px;
  width: 9px;
  height: 9px;
  padding: 0;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  border: 1px solid rgba(148, 156, 168, 0.45);
  background: #ffffff;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  cursor: crosshair;
  transform-origin: center;
  transition: opacity 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.card:hover .connector-handle,
.card.is-selected .connector-handle {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.connector-handle:hover {
  background: #ffffff;
  border-color: rgba(148, 156, 168, 0.7);
  transform: scale(1.25);
}

.connector-handle:active {
  background: #ffffff;
  transform: scale(1.15);
}

.card.is-column-child {
  min-height: 0;
}

.card.is-column-child .card-body {
  padding: 8px 10px;
}

.card.is-column-child .card-body [contenteditable] {
  min-height: 0;
}

.card.is-drop-hint {
  transform: scale(0.8);
}

.card.column.is-drop-target {
  border-color: rgba(199, 204, 212, 0.6);
  box-shadow: 0 0 0 2px rgba(199, 204, 212, 0.35), var(--card-shadow);
}

.card.is-connector-target {
  box-shadow: 0 0 0 2px rgba(199, 204, 212, 0.45), var(--card-shadow);
}

#board.has-multi-selection .card.is-selected .card-body {
  pointer-events: none;
  user-select: none;
}

.card.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.card.is-dragging * {
  user-select: none;
}

.card-body {
  height: 100%;
  padding: 12px 14px;
  overflow: auto;
  font-size: var(--content-font-size);
  border-radius: var(--radius);
}

.card.line .card-body {
  padding: 0;
  overflow: visible;
}

.card.line .line-body {
  position: relative;
  width: 100%;
  height: 100%;
}

.card.line .line-segment {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: clamp(2px, 20%, 6px);
  background: currentColor;
  border-radius: 999px;
  transform: translateY(-50%);
  pointer-events: none;
}

.card-body [contenteditable] {
  min-height: 100%;
  outline: none;
  white-space: pre-wrap;
  cursor: text;
}

.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 24px;
  height: 24px;
  border-right: 2px solid rgba(255, 255, 255, 0.35);
  border-bottom: 2px solid rgba(255, 255, 255, 0.35);
  transform: rotate(0deg);
  opacity: 0;
  pointer-events: none;
  cursor: se-resize;
}

.card:hover .resize-handle {
  opacity: 1;
  pointer-events: auto;
}

.media-box {
  height: 100%;
  width: 100%;
  border-radius: var(--radius);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(14, 18, 23, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  padding: 8px;
}

.card.media .card-body {
  padding: 0;
  overflow: hidden;
}

.card.media .media-box {
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: block;
}

.card.media .media-box.placeholder {
  border: 1px dashed rgba(255, 255, 255, 0.15);
  background: rgba(14, 18, 23, 0.55);
  padding: 12px;
  border-radius: var(--radius);
}

.card.media .media-box img,
.card.media .media-box video {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.media-box.embed-box {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  gap: 0;
}

.media-box.embed-box .media-actions {
  padding: 8px;
  justify-content: center;
  background: rgba(12, 15, 20, 0.6);
}

.media-box img,
.media-box video {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
}

.media-box audio {
  width: 100%;
}

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

.inline-input {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 16, 21, 0.55);
  color: var(--ink);
  padding: 6px 8px;
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.checklist-row input[type="text"] {
  flex: 1;
  min-width: 0;
  border-radius: 0;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
}

.checklist-row input[type="text"]:focus {
  outline: 1px solid rgba(199, 204, 212, 0.45);
}

.checklist-row.is-done input[type="text"] {
  text-decoration: line-through;
  color: var(--muted);
}

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 2px 0;
}

.task-checkbox {
  width: 14px;
  height: 14px;
  margin: 2px 0 0;
  accent-color: currentColor;
}

.task-text {
  flex: 1;
  min-width: 0;
}

.task-row.is-done .task-text {
  text-decoration: line-through;
  color: var(--muted);
}

.task-meta {
  margin-left: 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  white-space: nowrap;
}

.task-meta[hidden] {
  display: none;
}

.card.column {
  background: #12161c;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.card.column .card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.column-title {
  font-family: var(--font-display);
  font-size: calc(var(--content-font-size) * 1.15);
  font-weight: 600;
  letter-spacing: 0.4px;
  text-align: center;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.column-title[contenteditable="true"] {
  outline: none;
  border-radius: 6px;
  padding: 2px 4px;
  cursor: text;
}

.column-hint {
  font-size: 11px;
  text-align: center;
  color: rgba(154, 160, 166, 0.75);
}

.card.column.has-children .column-hint {
  display: none;
}

.card.frame {
  background: rgba(18, 22, 28, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.card.frame .card-body {
  color: var(--muted);
  font-size: calc(var(--content-font-size) * 0.9);
}

.card.board {
  border: none;
  background: transparent;
  box-shadow: none;
  min-width: 0;
  min-height: 0;
}

.card.board.is-selected {
  box-shadow: 0 0 0 2px rgba(199, 204, 212, 0.5), var(--card-shadow);
}

.card.board .card-body {
  padding: 0;
}

.board-preview {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: auto;
  justify-content: flex-start;
  width: fit-content;
}

.board-cover {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 13, 18, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.board-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.board-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(199, 204, 212, 0.7);
  background: rgba(10, 12, 15, 0.55);
}

.board-cover-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.board-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  min-width: 0;
  max-width: 200px;
}

.board-preview .board-title {
  font-family: var(--font-display);
  font-size: calc(var(--content-font-size) * 1.15);
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-title[contenteditable="true"],
.board-subtext[contenteditable="true"] {
  outline: none;
  cursor: text;
}

.board-title[contenteditable="true"]:empty::before,
.board-subtext[contenteditable="true"]:empty::before {
  content: attr(data-placeholder);
  color: rgba(154, 160, 166, 0.65);
}

.board-subtext {
  font-size: calc(var(--content-font-size) * 0.85);
  color: var(--muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.card.color-slate {
  --card-bg: #151d2d;
  --card-accent: rgba(140, 164, 255, 0.7);
}

.card.color-amber {
  --card-bg: #241a12;
  --card-accent: rgba(244, 169, 74, 0.8);
}

.card.color-teal {
  --card-bg: #0f1f21;
  --card-accent: rgba(102, 224, 212, 0.8);
}

.card.color-rose {
  --card-bg: #21141b;
  --card-accent: rgba(240, 125, 142, 0.8);
}


#help-panel {
  position: absolute;
  top: calc(var(--nav-height) + 16px);
  right: 24px;
  width: 280px;
  padding: 18px;
  border-radius: var(--radius);
  background: rgba(14, 17, 22, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  z-index: 5;
}

.settings-panel {
  position: absolute;
  top: calc(var(--nav-height) + 16px);
  right: 24px;
  width: 280px;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(14, 17, 22, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-panel[hidden] {
  display: none;
}

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

.settings-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
}

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

.settings-panel .segmented {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-panel .segmented.is-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#help-panel h2 {
  margin-top: 0;
  font-family: var(--font-display);
}

#help-panel ul {
  padding-left: 18px;
  color: var(--muted);
  margin: 0 0 12px 0;
}

#toast {
  position: absolute;
  bottom: 24px;
  left: 24px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: rgba(18, 22, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#toast.visible {
  opacity: 1;
}

.drop-target {
  outline: 2px dashed rgba(199, 204, 212, 0.8);
  outline-offset: 6px;
}

@media (max-width: 900px) {
  #workspace {
    padding-top: 0;
    padding-left: 0;
  }

  .nav-bar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .nav-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-center {
    order: 2;
    width: 100%;
  }

  .nav-left {
    order: 1;
  }

  #toolbar {
    position: static;
    width: auto;
    margin: 0;
    height: auto;
    box-shadow: none;
    margin-top: var(--nav-height);
  }

  #help-panel {
    right: 16px;
    left: 16px;
    width: auto;
  }

  #settings-panel {
    right: 16px;
    left: 16px;
    width: auto;
  }
}