:root {
  --bg: #efe6d8;
  --panel: rgba(255, 250, 242, 0.9);
  --panel-strong: #fff9f2;
  --border: rgba(109, 77, 54, 0.14);
  --text: #2f241c;
  --muted: #746758;
  --accent: #b76f45;
  --accent-soft: rgba(183, 111, 69, 0.16);
  --shadow: 0 20px 50px rgba(76, 54, 33, 0.1);
  --radius: 22px;
  --canvas-grid: rgba(112, 87, 63, 0.08);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 251, 244, 0.8), transparent 32%),
    radial-gradient(circle at bottom right, rgba(205, 138, 95, 0.18), transparent 28%),
    linear-gradient(145deg, #f8f0e4 0%, #ebe1d2 100%);
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.88rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.main-panel {
  position: relative;
  width: 100%;
  height: 100%;
}

.menu-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 28;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  cursor: pointer;
  padding: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  box-shadow: 0 12px 30px rgba(36, 43, 54, 0.14);
  backdrop-filter: blur(18px) saturate(1.1);
}

.menu-toggle[hidden],
.sidebar-collapse-button[hidden] {
  display: none;
}

.desktop-update-badge {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 32;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
  min-height: 36px;
  padding: 5px 6px 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  box-shadow: 0 14px 34px rgba(36, 43, 54, 0.14);
  backdrop-filter: blur(18px) saturate(1.12);
}

.desktop-update-badge[hidden] {
  display: none;
}

.desktop-update-badge span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 700;
}

.desktop-update-badge button {
  flex: 0 0 auto;
  height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: #2f241c;
  color: #fff9f2;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.desktop-update-badge button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.sidebar {
  position: fixed;
  inset: 14px auto 102px 14px;
  z-index: 24;
  width: min(306px, calc(100vw - 28px));
  padding: 10px;
  overflow: hidden;
  transform: translateX(0);
  opacity: 1;
  transition: transform 180ms ease, opacity 180ms ease;
  background: rgba(255, 255, 255, 0.44);
  border-color: rgba(255, 255, 255, 0.54);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(35, 41, 50, 0.14);
  backdrop-filter: blur(24px) saturate(1.12);
}

.shell.sidebar-collapsed .sidebar {
  transform: translateX(calc(-100% - 24px));
  opacity: 0;
  pointer-events: none;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-width: 0;
  overflow: auto;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(55, 62, 73, 0.26) transparent;
}

.sidebar-inner::-webkit-scrollbar {
  width: 7px;
}

.sidebar-inner::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-inner::-webkit-scrollbar-thumb {
  background: rgba(55, 62, 73, 0.18);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.sidebar-collapse-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 10px;
  font-size: 1rem;
  line-height: 1;
  flex: 0 0 auto;
}

.sidebar-session-button[hidden] {
  display: none;
}

.sidebar-session-button {
  white-space: nowrap;
  font-size: 0.76rem;
}

.sidebar-section,
.sidebar-details {
  padding-top: 12px;
  border-top: 1px solid rgba(109, 77, 54, 0.1);
}

.sidebar-section:first-of-type,
.sidebar-details:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.sidebar-details > summary {
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-details > summary::-webkit-details-marker {
  display: none;
}

.sidebar-details[open] > summary {
  margin-bottom: 8px;
}

.search-row,
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-head h2 {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-section-head {
  flex-wrap: nowrap;
}

.search-row input {
  flex: 1;
  min-width: 0;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toggle-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
}

.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.color-choice {
  margin: 0;
  padding: 0;
  border: 0;
}

.color-choice legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.color-choice-options {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.color-choice-swatch,
.color-choice-custom {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid rgba(88, 65, 47, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  cursor: pointer;
}

.color-choice-swatch input,
.color-choice-custom > input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.color-choice-swatch span {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(31, 24, 19, 0.18);
  border-radius: 999px;
  background: var(--swatch-color);
}

.color-choice-swatch input:checked + span,
.color-choice-custom > input[type="radio"]:checked + input[type="color"] {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.color-choice-custom input[type="color"] {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
}

.color-choice-custom input[type="text"] {
  width: 92px;
  min-height: 28px;
  padding: 4px 7px;
  font-size: 0.8rem;
}

.shape-choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
}

.shape-choice legend {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.shape-choice-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 8px;
}

.shape-choice-option {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(88, 65, 47, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
  cursor: pointer;
}

.shape-choice-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.shape-choice-option span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 44px;
  border-radius: 12px;
  background: rgba(47, 36, 28, 0.05);
}

.shape-choice-option svg {
  width: 48px;
  height: 32px;
  overflow: visible;
  fill: none;
  stroke: #2f241c;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shape-choice-option:has(input:checked) {
  border-color: rgba(183, 111, 69, 0.48);
  background: rgba(255, 248, 238, 0.92);
  box-shadow: inset 0 0 0 1px rgba(183, 111, 69, 0.2);
}

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

.pill-button,
.ghost-button,
.project-item {
  border: 0;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease, opacity 120ms ease;
}

.pill-button {
  background: var(--accent);
  color: white;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: none;
}

.pill-button.alt {
  background: #5d7b69;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.34);
  color: var(--text);
  padding: 7px 10px;
  border: 1px solid rgba(55, 62, 73, 0.08);
  border-radius: 10px;
  font-size: 0.82rem;
}

.menu-toggle,
.sidebar-collapse-button {
  padding: 0;
}

.menu-toggle {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  font-size: 1rem;
}

.pill-button:hover,
.ghost-button:hover,
.project-item:hover {
  transform: translateY(-1px);
}

.pill-button:disabled,
.ghost-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

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

.stack.compact {
  gap: 8px;
}

.project-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-row-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-item {
  display: flex;
  align-items: center;
  width: 100%;
  flex: 1;
  min-width: 0;
  min-height: 34px;
  text-align: left;
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 9px;
  font-size: 0.86rem;
}

.project-item strong {
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-item.active {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(55, 62, 73, 0.14);
  box-shadow: inset 0 0 0 1px rgba(183, 111, 69, 0.14);
  outline: 0;
}

.project-row-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.project-menu {
  position: relative;
}

.project-menu[open] {
  z-index: 20;
}

.project-menu > summary {
  list-style: none;
}

.project-menu > summary::-webkit-details-marker {
  display: none;
}

.project-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 9px;
  line-height: 1;
}

.project-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 142px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(55, 62, 73, 0.12);
  box-shadow: 0 14px 34px rgba(35, 41, 50, 0.16);
  backdrop-filter: blur(20px);
  z-index: 8;
}

.project-menu-action {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 7px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.84rem;
}

.project-menu-action:hover,
.project-menu-action:focus-visible {
  background: rgba(47, 36, 28, 0.07);
}

.project-menu-action.destructive {
  color: #9c3b28;
}

.sidebar-subgroup {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(109, 77, 54, 0.12);
}

.sidebar-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sidebar-subhead h3 {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.deleted-project-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.3);
}

.project-add-button {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 10px;
  font-size: 1rem;
  line-height: 1;
}

.deleted-project-row:hover .restore-button,
.deleted-project-row:focus-within .restore-button {
  opacity: 1;
  pointer-events: auto;
}

.deleted-project-name {
  flex: 1;
  min-width: 0;
}

.restore-button {
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.canvas-viewport {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  cursor: grab;
  scrollbar-width: thin;
  scrollbar-color: rgba(55, 62, 73, 0.24) transparent;
  background:
    radial-gradient(circle, var(--canvas-grid) 1px, transparent 1px) center / 18px 18px,
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(243, 235, 223, 0.96));
}

.canvas-viewport::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.canvas-viewport::-webkit-scrollbar-track {
  background: transparent;
}

.canvas-viewport::-webkit-scrollbar-thumb {
  background: rgba(55, 62, 73, 0.18);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.canvas-viewport.mode-select,
.canvas-viewport.is-selecting {
  cursor: crosshair;
  user-select: none;
}

.canvas-viewport.is-panning {
  cursor: grabbing;
  user-select: none;
}

.canvas-viewport.mode-select .project-region,
.canvas-viewport.mode-select .asset-card {
  cursor: default;
}

.canvas-viewport.mode-select .asset-card.selected {
  cursor: grab;
}

.canvas-viewport.is-drop-target {
  outline: 2px dashed rgba(183, 111, 69, 0.55);
  outline-offset: -10px;
}

.canvas-stage {
  position: relative;
  width: 2200px;
  height: 1600px;
  transform-origin: top left;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bottom-dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  max-width: calc(100vw - 32px);
  padding: 8px 10px;
  transform: translateX(-50%);
}

.project-action-bar {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 23;
  display: flex;
  align-items: center;
  gap: 3px;
  width: auto;
  max-width: calc(100vw - 36px);
  padding: 5px;
  border-radius: 14px;
  background: rgba(255, 251, 245, 0.82);
  border: 1px solid rgba(90, 72, 54, 0.1);
  box-shadow:
    0 14px 34px rgba(55, 43, 32, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(1.08);
}

.project-action-bar[hidden] {
  display: none;
}

.project-tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  box-shadow: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.project-tool-button:hover,
.project-tool-button:focus-visible {
  background: rgba(255, 255, 255, 0.76);
  border-color: rgba(183, 111, 69, 0.18);
  color: var(--accent);
  outline: none;
  transform: translateY(-1px);
}

.project-tool-button:focus-visible {
  box-shadow: 0 0 0 2px rgba(183, 111, 69, 0.18);
}

.project-tool-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  color: currentColor;
}

.project-tool-icon-note {
  border: 1.8px solid currentColor;
  border-radius: 4px;
}

.project-tool-icon-note::before,
.project-tool-icon-note::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  height: 1.6px;
  border-radius: 999px;
  background: currentColor;
}

.project-tool-icon-note::before {
  top: 5px;
}

.project-tool-icon-note::after {
  top: 10px;
}

.project-tool-icon-text::before {
  content: "T";
  position: absolute;
  inset: -2px 0 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.project-tool-icon-table {
  border: 1.8px solid currentColor;
  border-radius: 4px;
  background:
    linear-gradient(currentColor, currentColor) 50% 0 / 1.6px 100% no-repeat,
    linear-gradient(currentColor, currentColor) 0 50% / 100% 1.6px no-repeat;
}

.project-tool-icon-annotation::before,
.project-tool-icon-annotation::after {
  content: "";
  position: absolute;
  background: currentColor;
  border-radius: 999px;
}

.project-tool-icon-annotation::before {
  left: 2px;
  right: 2px;
  top: 8px;
  height: 2px;
  transform: rotate(-28deg);
}

.project-tool-icon-annotation::after {
  right: 1px;
  top: 4px;
  width: 7px;
  height: 7px;
  clip-path: polygon(0 0, 100% 50%, 0 100%, 25% 50%);
}

.project-tool-icon-image {
  border: 1.8px solid currentColor;
  border-radius: 4px;
  overflow: hidden;
}

.project-tool-icon-image::before {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.project-tool-icon-image::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 7px;
  background: currentColor;
  clip-path: polygon(0 100%, 38% 35%, 56% 58%, 72% 25%, 100% 100%);
}

.project-tool-icon-link::before,
.project-tool-icon-link::after {
  content: "";
  position: absolute;
  top: 5px;
  width: 10px;
  height: 6px;
  border: 1.8px solid currentColor;
  border-radius: 999px;
}

.project-tool-icon-link::before {
  left: 1px;
  transform: rotate(-34deg);
}

.project-tool-icon-link::after {
  right: 1px;
  transform: rotate(-34deg);
}

.dock-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dock-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  font-size: 1rem;
}

.dock-mode-button {
  transition: background 120ms ease, color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.dock-mode-button:hover {
  transform: translateY(-1px);
}

.dock-mode-button[data-canvas-mode="select"] {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 24px rgba(183, 111, 69, 0.2);
}

.dock-mode-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
}

.dock-mode-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.project-region {
  position: absolute;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid rgba(93, 77, 58, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  cursor: grab;
  overflow: visible;
  transform-origin: center center;
}

.project-region.selected {
  outline: 2px solid rgba(183, 111, 69, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 24px 44px rgba(102, 72, 47, 0.11);
}

.project-region.selection-preview {
  outline: 2px solid rgba(87, 124, 103, 0.5);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 24px 44px rgba(77, 109, 91, 0.1);
}

.project-region .project-region-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.project-region-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.project-region-summary {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 251, 245, 0.7);
  line-height: 1.45;
}

.region-description-toggle {
  padding: 6px 10px;
  border-radius: 999px;
}

.asset-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 253, 249, 0.9);
  border: 1px solid rgba(113, 83, 59, 0.12);
  box-shadow: 0 14px 32px rgba(73, 53, 36, 0.08);
  overflow: visible;
  cursor: grab;
  text-align: left;
  transform-origin: center center;
}

.asset-card.selected {
  outline: 2px solid rgba(183, 111, 69, 0.6);
}

.asset-card.selection-preview {
  outline: 2px dashed rgba(87, 124, 103, 0.56);
}

.asset-card .badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(47, 36, 28, 0.08);
  color: var(--muted);
  font-size: 0.74rem;
}

.asset-card.image {
  padding: 0;
  gap: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.asset-card.image .asset-card-media {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 22px;
  background: rgba(117, 98, 80, 0.06);
  overflow: hidden;
}

.asset-card.image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.asset-card.image .image-title-overlay {
  position: absolute;
  inset: 0 auto auto 0;
  max-width: calc(100% - 28px);
  padding: 14px;
  pointer-events: none;
}

.asset-card.image .image-title-overlay span {
  display: inline-flex;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 24, 19, 0.62);
  color: white;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 18px rgba(22, 16, 12, 0.18);
}

.asset-card.note {
  background: #fff4cf;
}

.asset-card.text {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.asset-card.shape {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.asset-card.shape.selected {
  outline: 2px solid rgba(183, 111, 69, 0.4);
  border-radius: 14px;
}

.annotation-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.annotation-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  max-width: min(220px, 80vw);
  padding: 4px 7px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 8px 18px rgba(50, 36, 24, 0.12);
  pointer-events: none;
}

.asset-card.text.selected {
  outline: 2px solid rgba(183, 111, 69, 0.4);
  border-radius: 16px;
}

.text-asset-content {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--text-asset-color, rgba(47, 36, 28, 0.92));
  line-height: 1.08;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.asset-card.text.text-size-small .text-asset-content {
  font-size: 1rem;
  font-weight: 500;
}

.asset-card.text.text-size-medium .text-asset-content {
  font-size: 1.45rem;
  font-weight: 600;
}

.asset-card.text.text-size-large .text-asset-content {
  font-size: 2.2rem;
  font-weight: 700;
}

.inline-text-composer {
  position: absolute;
  display: block;
  padding: 0;
  background: transparent;
  border-radius: 16px;
  overflow: visible;
  z-index: 12;
}

.inline-text-input {
  width: 100%;
  min-height: 44px;
  padding: 0;
  margin: 0;
  border: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: rgba(47, 36, 28, 0.92);
  line-height: 1.08;
  box-shadow: none;
  cursor: text;
}

.inline-text-input::placeholder {
  color: rgba(116, 103, 88, 0.72);
}

.inline-text-composer.text-size-small .inline-text-input {
  font-size: 1rem;
  font-weight: 500;
}

.inline-text-composer.text-size-medium .inline-text-input {
  font-size: 1.45rem;
  font-weight: 600;
}

.inline-text-composer.text-size-large .inline-text-input {
  font-size: 2.2rem;
  font-weight: 700;
}

.asset-card.link {
  padding: 0;
  gap: 0;
  overflow: visible;
  background: #fbfaf6;
}

.link-preview-media {
  width: 100%;
  flex: 0 0 72px;
  background: rgba(117, 98, 80, 0.08);
  border-bottom: 1px solid rgba(113, 83, 59, 0.1);
  border-radius: 22px 22px 0 0;
  overflow: hidden;
}

.asset-card.link.has-preview-media .link-preview-media {
  flex-basis: 46%;
  min-height: 76px;
  max-height: 170px;
}

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

.link-preview-content {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

.asset-card.link:not(.has-preview-media) .link-preview-content {
  justify-content: center;
}

.link-preview-content strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.2;
}

.link-preview-content p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.35;
}

.asset-card.table {
  background: rgba(255, 252, 247, 0.96);
}

.table-quick-actions {
  display: contents;
}

.table-quick-action {
  position: absolute;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(87, 124, 103, 0.28);
  border-radius: 999px;
  padding: 0;
  background: rgba(244, 251, 247, 0.98);
  color: #385f4a;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 10px 20px rgba(49, 82, 65, 0.16);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease, background 0.14s ease;
  z-index: 3;
}

.table-quick-action-row {
  left: 50%;
  bottom: -13px;
  transform: translate(-50%, 3px);
}

.table-quick-action-column {
  right: -13px;
  top: 50%;
  transform: translate(3px, -50%);
}

.asset-card.table:hover .table-quick-action,
.asset-card.table:focus-within .table-quick-action,
.asset-card.table.selected .table-quick-action {
  opacity: 1;
  pointer-events: auto;
}

.asset-card.table:hover .table-quick-action-row,
.asset-card.table:focus-within .table-quick-action-row,
.asset-card.table.selected .table-quick-action-row {
  transform: translate(-50%, 0);
}

.asset-card.table:hover .table-quick-action-column,
.asset-card.table:focus-within .table-quick-action-column,
.asset-card.table.selected .table-quick-action-column {
  transform: translate(0, -50%);
}

.table-quick-action:hover,
.table-quick-action:focus-visible {
  background: #eef8f2;
  outline: 2px solid rgba(87, 124, 103, 0.32);
  outline-offset: 2px;
}

.selection-controls {
  position: absolute;
  pointer-events: none;
  z-index: 18;
}

.selection-control {
  pointer-events: auto;
}

.resize-handle {
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
  border: 2px solid rgba(255, 249, 240, 0.96);
  box-shadow: 0 10px 18px rgba(93, 58, 33, 0.18);
  cursor: nwse-resize;
  touch-action: none;
  z-index: 2;
}

.rotation-handle {
  position: absolute;
  left: 50%;
  top: -34px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(87, 124, 103, 0.34);
  background: rgba(255, 253, 249, 0.98);
  color: #385f4a;
  box-shadow: 0 10px 18px rgba(49, 82, 65, 0.16);
  cursor: grab;
  transform: translateX(-50%);
  touch-action: none;
  z-index: 3;
}

.delete-handle {
  position: absolute;
  right: -12px;
  top: -12px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(156, 59, 40, 0.28);
  background: rgba(255, 253, 249, 0.98);
  color: #9c3b28;
  box-shadow: 0 10px 18px rgba(88, 42, 32, 0.14);
  cursor: pointer;
  touch-action: none;
  z-index: 3;
}

.rotation-handle svg,
.delete-handle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.delete-handle:hover,
.delete-handle:focus-visible {
  background: #fff2ee;
  border-color: rgba(156, 59, 40, 0.58);
  outline: 2px solid rgba(156, 59, 40, 0.18);
  outline-offset: 2px;
}

.selection-controls.rotation-locked .rotation-handle {
  border-color: rgba(87, 124, 103, 0.68);
  background: #eef8f2;
  box-shadow:
    0 0 0 3px rgba(87, 124, 103, 0.14),
    0 10px 18px rgba(49, 82, 65, 0.16);
}

.rotation-handle:active {
  cursor: grabbing;
}

.selection-marquee {
  position: absolute;
  border: 1px solid rgba(87, 124, 103, 0.78);
  background: rgba(87, 124, 103, 0.12);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    0 14px 30px rgba(77, 109, 91, 0.08);
  border-radius: 16px;
  pointer-events: none;
  z-index: 11;
}

.table-preview {
  margin-top: 10px;
  border-radius: 14px;
  overflow: auto;
  border: 1px solid rgba(113, 83, 59, 0.12);
  background: rgba(255, 255, 255, 0.85);
}

.table-preview table {
  width: 100%;
  min-width: max(100%, calc(var(--table-column-count, 3) * 132px));
  border-collapse: collapse;
  font-size: 0.78rem;
}

.table-preview th,
.table-preview td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(113, 83, 59, 0.1);
  text-align: left;
  vertical-align: top;
}

.table-preview th {
  background: rgba(47, 36, 28, 0.06);
}

.table-inline-input {
  width: 100%;
  min-width: 112px;
  min-height: 28px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
}

.table-inline-heading {
  font-weight: 700;
}

.table-inline-input:hover,
.table-inline-input:focus {
  border-color: rgba(87, 124, 103, 0.34);
  background: rgba(255, 255, 255, 0.78);
  outline: none;
}

.table-empty {
  padding: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(55, 62, 73, 0.12);
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
}

.toggle-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  padding: 0;
}

.result-item,
.activity-item {
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.32);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.hosted-connect-root {
  position: fixed;
  inset: 0;
  z-index: 36;
}

.hosted-connect-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(39, 29, 21, 0.32);
  backdrop-filter: blur(6px);
}

.hosted-connect-panel {
  position: relative;
  width: min(540px, calc(100vw - 32px));
  margin: 64px auto;
  padding: 24px;
  background: var(--panel-strong);
}

.hosted-source-choice {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.hosted-source-choice legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.hosted-source-choice label {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(88, 65, 47, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.56);
  cursor: pointer;
}

.hosted-source-choice input {
  margin-top: 2px;
  accent-color: var(--accent);
}

.hosted-source-choice strong,
.hosted-source-choice small {
  display: block;
}

.hosted-source-choice strong {
  font-size: 0.9rem;
}

.hosted-source-choice small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.hosted-connect-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(39, 29, 21, 0.38);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  margin: 24px auto;
  padding: 22px;
  background: var(--panel-strong);
}

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

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

.modal-grid .full-span {
  grid-column: 1 / -1;
}

.table-builder {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.table-builder-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.table-builder-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.table-builder-stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(109, 77, 54, 0.12);
}

.table-builder-stepper span {
  padding-left: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.table-builder-stepper strong {
  min-width: 20px;
  text-align: center;
  font-size: 0.86rem;
}

.table-builder-stepper button,
.table-builder-mini-button {
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(87, 124, 103, 0.12);
  color: #385f4a;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.table-builder-stepper button {
  width: 26px;
  height: 26px;
}

.table-builder-mini-button {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.table-builder-stepper button:hover,
.table-builder-mini-button:hover,
.table-builder-stepper button:focus-visible,
.table-builder-mini-button:focus-visible {
  background: rgba(87, 124, 103, 0.2);
  outline: 2px solid rgba(87, 124, 103, 0.24);
  outline-offset: 2px;
}

.table-builder-scroll {
  max-height: min(46vh, 460px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(109, 77, 54, 0.14);
  background: rgba(255, 255, 255, 0.78);
}

.table-builder-grid {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

.table-builder-grid th,
.table-builder-grid td {
  padding: 8px;
  border-bottom: 1px solid rgba(109, 77, 54, 0.1);
  border-right: 1px solid rgba(109, 77, 54, 0.1);
  vertical-align: top;
}

.table-builder-grid th:last-child,
.table-builder-grid td:last-child {
  border-right: 0;
}

.table-builder-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fffaf2;
}

.table-builder-corner,
.table-builder-row-head {
  width: 54px;
}

.table-builder-row-head {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  background: rgba(47, 36, 28, 0.04);
}

.table-builder-column-head {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.table-builder-row-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.table-builder-grid input {
  width: 100%;
  min-width: 0;
  border-radius: 10px;
  padding: 8px 9px;
  background: rgba(255, 253, 249, 0.92);
}

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

.modal-error,
.modal-message {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 14px;
}

.modal-error {
  background: rgba(156, 59, 40, 0.12);
  color: #8b3424;
}

.modal-message {
  background: rgba(47, 36, 28, 0.06);
  color: var(--muted);
}

.modal-display {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(109, 77, 54, 0.12);
  line-height: 1.45;
  white-space: pre-wrap;
}

.share-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.share-list-header,
.share-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-list-header {
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 700;
}

.share-list-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.share-list-row,
.share-list-empty,
.share-list-error {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(109, 77, 54, 0.12);
  background: rgba(255, 255, 255, 0.62);
}

.share-list-main {
  flex: 1;
  min-width: 0;
}

.share-list-main strong,
.share-list-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-list-main span,
.share-list-state {
  color: var(--muted);
  font-size: 0.78rem;
}

.share-list-state {
  flex: 0 0 auto;
  font-weight: 700;
}

.share-list-action {
  flex: 0 0 auto;
}

.share-list-error {
  background: rgba(156, 59, 40, 0.08);
  color: #8b3424;
}

.file-hint {
  margin-top: 6px;
}

.context-menu-root {
  position: fixed;
  min-width: 160px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 249, 241, 0.98);
  border: 1px solid var(--border);
  box-shadow: 0 18px 36px rgba(66, 49, 34, 0.18);
  z-index: 60;
}

.context-menu-item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--text);
  padding: 9px 10px;
  border-radius: 12px;
  cursor: pointer;
}

.context-menu-item:hover,
.context-menu-item:focus-visible {
  background: rgba(47, 36, 28, 0.07);
}

.context-menu-item.destructive {
  color: #9c3b28;
}

.destructive-button {
  background: #9c3b28;
  color: white;
}

.result-item button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

@media (max-width: 920px) {
  .bottom-dock {
    max-width: calc(100vw - 28px);
  }

  .hosted-connect-panel {
    margin: 28px auto;
  }
}

@media (max-width: 760px) {
  .sidebar {
    inset: 14px auto 98px 14px;
    width: min(306px, calc(100vw - 28px));
  }

  .menu-toggle {
    top: 14px;
    left: 14px;
  }

  .bottom-dock {
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }

  .project-action-bar {
    top: auto;
    right: 14px;
    bottom: 72px;
    left: 14px;
    max-width: none;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .project-action-bar::-webkit-scrollbar {
    display: none;
  }

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