:root {
  --color-primary: #ce0f69;
  --color-secondary-teal: #009ca6;
  --color-secondary-purple: #68478d;
  --color-tertiary-gold: #ffb81c;
  --color-tertiary-black: #000000;
}

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

/* Any class below that sets `display` would otherwise beat the browser's
   own [hidden] rule and keep "hidden" elements on screen. */
[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f5f7;
  color: var(--color-tertiary-black);
}

a {
  color: inherit;
}

.spacer {
  flex: 1;
}

/* ---------------------------------------------------------------------
   App shell and nav
   --------------------------------------------------------------------- */

.app-shell {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.app-shell.narrow {
  max-width: 720px;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
  border-radius: 16px;
  padding: 14px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.nav-brand {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
  padding: 8px 4px;
}

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

.nav-email {
  font-size: 0.8rem;
  color: #6b7280;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 7px 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-logout:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ---------------------------------------------------------------------
   Cards and headings
   --------------------------------------------------------------------- */

.card {
  width: 100%;
  background: #ffffff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.card.accent {
  border-top: 6px solid transparent;
  border-image: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-secondary-teal),
    var(--color-secondary-purple),
    var(--color-tertiary-gold)
  );
  border-image-slice: 1;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title {
  min-width: 0;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.1rem;
}

.section-heading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  margin-bottom: 12px;
}

.subtitle {
  font-size: 0.9rem;
  color: #6b7280;
  line-height: 1.4;
}

.back-link {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
  margin-bottom: 8px;
}

.back-link:hover {
  color: var(--color-primary);
}

.status {
  font-size: 0.9rem;
  color: #6b7280;
  text-align: center;
  padding: 40px 0;
}

.status.error {
  color: var(--color-primary);
}

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  padding: 12px 20px;
  color: #ffffff;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  transition: box-shadow 0.15s ease;
}

.btn-primary:hover {
  box-shadow: 0 0 0 3px rgba(206, 15, 105, 0.12);
}

.btn-secondary {
  padding: 12px 18px;
  color: var(--color-tertiary-black);
  background: #ffffff;
  border: 1px solid #d1d5db;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--color-primary);
}

.btn-secondary.danger:hover {
  color: var(--color-primary);
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

.btn-primary.small,
.btn-secondary.small {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn-text {
  display: inline-block;
  padding: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease;
}

.btn-text:hover {
  color: var(--color-tertiary-black);
}

.btn-text.danger:hover {
  color: var(--color-primary);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
  color: #9ca3af;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn.danger:hover {
  color: var(--color-primary);
  background: rgba(206, 15, 105, 0.1);
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

:where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */

.input-group {
  margin-bottom: 20px;
}

label,
.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #374151;
}

.field-hint {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 6px;
  line-height: 1.4;
}

.text-input,
.text-select {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-tertiary-black);
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea.text-input {
  resize: vertical;
  line-height: 1.5;
}

.text-input.small {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.text-select.compact {
  width: auto;
  max-width: 180px;
  padding: 8px 10px;
  font-size: 0.85rem;
}

.text-input:focus,
.text-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(206, 15, 105, 0.12);
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
}

.check-label input,
.task-done {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.form-error {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

/* ---------------------------------------------------------------------
   Auth gate
   --------------------------------------------------------------------- */

.auth-landing {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  margin: 40px auto;
}

.hero-copy {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.hero-copy h1 {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.hero-tagline {
  font-size: 1rem;
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 22px;
}

.hero-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.hero-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.4;
}

.hero-features li::before {
  content: "✓";
  flex-shrink: 0;
  color: var(--color-secondary-teal);
  font-weight: 700;
}

.auth-shell {
  max-width: 400px;
}

.auth-shell .page-title {
  margin-bottom: 24px;
}

/* ---------------------------------------------------------------------
   Empty state, badges, chips
   --------------------------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 48px 24px;
  color: #6b7280;
}

.empty-state h2 {
  color: var(--color-tertiary-black);
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
}

.badge-owner {
  color: var(--color-secondary-purple);
  background: rgba(104, 71, 141, 0.1);
}

.badge-shared,
.badge-hotspots {
  color: var(--color-secondary-teal);
  background: rgba(0, 156, 166, 0.1);
}

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.chip-trade,
.chip-photo {
  color: var(--color-secondary-teal);
  background: rgba(0, 156, 166, 0.1);
}

.chip-room,
.chip-task {
  color: var(--color-secondary-purple);
  background: rgba(104, 71, 141, 0.1);
}

.chip-muted {
  color: #6b7280;
  background: #f0f1f3;
}

/* ---------------------------------------------------------------------
   Lists overview (index.html)
   --------------------------------------------------------------------- */

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

.list-card {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: #f9fafb;
  border: 1px solid #f0f1f3;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.list-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.list-card-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 18px 10px;
  text-decoration: none;
}

.list-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.list-card-meta {
  font-size: 0.85rem;
  color: #6b7280;
}

.list-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px 12px 18px;
  min-height: 44px;
}

/* ---------------------------------------------------------------------
   Tabs, toolbar, segmented control
   --------------------------------------------------------------------- */

.tab-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: #f4f5f7;
  border-radius: 12px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: none;
  border-radius: 9px;
  cursor: pointer;
}

.tab-btn.active {
  color: var(--color-tertiary-black);
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.tab-count {
  font-size: 0.75rem;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

.task-toolbar,
.panel-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.panel-head {
  justify-content: space-between;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: #f4f5f7;
  border-radius: 10px;
}

.segmented button {
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.segmented button.active {
  color: var(--color-tertiary-black);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ---------------------------------------------------------------------
   Task list
   --------------------------------------------------------------------- */

.task-group + .task-group {
  margin-top: 24px;
}

.group-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 1rem;
}

.group-heading .chip {
  font-size: 0.85rem;
  padding: 5px 12px;
}

.group-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
}

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px 8px 4px;
  background: #f9fafb;
  border: 1px solid #f0f1f3;
  border-radius: 10px;
}

.task-row.dragging {
  z-index: 40;
  background: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.task-placeholder {
  border: 2px dashed rgba(206, 15, 105, 0.35);
  border-radius: 10px;
  background: rgba(206, 15, 105, 0.03);
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 36px;
  font-size: 0.95rem;
  letter-spacing: -3px;
  color: #9ca3af;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
}

.drag-handle:hover {
  color: var(--color-tertiary-black);
  background: #f0f1f3;
}

.task-row.dragging .drag-handle {
  cursor: grabbing;
}

.task-done {
  flex-shrink: 0;
  margin-top: 9px;
}

.task-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 7px 0 5px;
  font-family: inherit;
  text-align: left;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.task-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task-main:hover .task-title {
  color: var(--color-primary);
}

.task-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #6b7280;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.ref-count {
  font-size: 0.74rem;
  font-weight: 600;
  color: #6b7280;
}

.task-row.done .task-title {
  color: #6b7280;
  text-decoration: line-through;
}

.task-row.done .chip {
  opacity: 0.6;
}

/* ---------------------------------------------------------------------
   Tag picker and tag management
   --------------------------------------------------------------------- */

.chip-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-toggle {
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip-toggle.chip-trade:hover {
  border-color: var(--color-secondary-teal);
}

.chip-toggle.chip-room:hover {
  border-color: var(--color-secondary-purple);
}

.chip-toggle.chip-trade.on {
  color: #ffffff;
  background: var(--color-secondary-teal);
  border-color: var(--color-secondary-teal);
}

.chip-toggle.chip-room.on {
  color: #ffffff;
  background: var(--color-secondary-purple);
  border-color: var(--color-secondary-purple);
}

.tag-add-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  max-width: 320px;
}

.tag-manage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.tag-manage-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tag-manage-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag-name-input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 0.88rem;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.tag-name-input:hover,
.tag-name-input:focus {
  background: #ffffff;
  border-color: #d1d5db;
  outline: none;
}

.tag-usage {
  min-width: 22px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

.ref-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ref-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: #f9fafb;
  border: 1px solid #f0f1f3;
  border-radius: 10px;
}

.ref-item:hover {
  border-color: var(--color-primary);
}

.ref-thumb {
  width: 36px;
  height: 36px;
  border-radius: 7px;
  overflow: hidden;
  background: #e5e7eb;
  flex-shrink: 0;
}

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

/* ---------------------------------------------------------------------
   Photo grid
   --------------------------------------------------------------------- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.photo-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-decoration: none;
  background: #f9fafb;
  border: 1px solid #f0f1f3;
  border-radius: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.photo-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.photo-card-thumb {
  display: block;
  aspect-ratio: 4 / 3;
  background: #e5e7eb;
  overflow: hidden;
}

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

.photo-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 12px;
}

.photo-card-name {
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Add photo: upload and crop
   --------------------------------------------------------------------- */

.upload-drop {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 24px;
  font-family: inherit;
  font-size: 0.95rem;
  text-align: center;
  color: #374151;
  background: #ffffff;
  border: 2px dashed #d1d5db;
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-drop:hover,
.upload-drop.dragover {
  border-color: var(--color-primary);
  background: rgba(206, 15, 105, 0.03);
}

.upload-drop-icon {
  font-size: 1.8rem;
}

.crop-hint {
  margin: 0 0 12px;
}

.crop-frame {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: #111827;
  border-radius: 12px;
  overflow: hidden;
}

.crop-stage {
  position: relative;
  flex-shrink: 0;
  user-select: none;
}

.crop-stage img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.crop-box {
  position: absolute;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.55);
  cursor: move;
  touch-action: none;
}

.crop-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border: 2px solid var(--color-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.crop-handle.nw { top: 0; left: 0; cursor: nwse-resize; }
.crop-handle.ne { top: 0; left: 100%; cursor: nesw-resize; }
.crop-handle.sw { top: 100%; left: 0; cursor: nesw-resize; }
.crop-handle.se { top: 100%; left: 100%; cursor: nwse-resize; }

.crop-tools {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 16px;
}

/* ---------------------------------------------------------------------
   Photo page: image with hotspots and side panel
   --------------------------------------------------------------------- */

.photo-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.photo-head {
  padding-bottom: 8px;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.editor-card,
.side-card {
  padding: 20px;
}

.side-card {
  position: sticky;
  top: 20px;
}

.stage-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.stage-toolbar .field-hint {
  margin: 0;
}

.image-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  background: #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  user-select: none;
  touch-action: pinch-zoom;
}

.image-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.image-stage.armed {
  cursor: crosshair;
  touch-action: none;
}

.image-stage.armed .hotspot:not(.drawing) {
  pointer-events: none;
  opacity: 0.6;
}

.hotspot-layer {
  position: absolute;
  inset: 0;
}

.hotspot {
  position: absolute;
  border: 2px solid var(--color-primary);
  border-radius: 6px;
  background: rgba(206, 15, 105, 0.14);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.hotspot:hover {
  background: rgba(206, 15, 105, 0.24);
}

.hotspot.selected {
  z-index: 5;
  background: rgba(206, 15, 105, 0.2);
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--color-primary);
  cursor: move;
  touch-action: none;
}

.hotspot.drawing {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.2);
}

.hotspot-num {
  position: absolute;
  top: -11px;
  left: -11px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--color-primary);
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.hotspot-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border: 2px solid var(--color-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  touch-action: none;
}

.hotspot-handle.nw { top: 0; left: 0; cursor: nwse-resize; }
.hotspot-handle.ne { top: 0; left: 100%; cursor: nesw-resize; }
.hotspot-handle.sw { top: 100%; left: 0; cursor: nesw-resize; }
.hotspot-handle.se { top: 100%; left: 100%; cursor: nwse-resize; }

/* Once selected, every corner has a handle, so the number badge moves to
   the middle of the top edge where it can't cover one. */
.hotspot.selected .hotspot-num {
  left: 50%;
  transform: translateX(-50%);
}

.hotspot-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hotspot-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  font-family: inherit;
  text-align: left;
  color: inherit;
  background: #f9fafb;
  border: 1px solid #f0f1f3;
  border-radius: 10px;
  cursor: pointer;
}

.hotspot-item:hover {
  border-color: var(--color-primary);
}

.hotspot-item-num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--color-primary);
  border-radius: 50%;
}

.hotspot-item-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hotspot-item-note {
  font-size: 0.85rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.hotspot-item-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.hotspot-item-empty {
  font-size: 0.85rem;
  color: #6b7280;
}

.side-head,
.side-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.side-head .section-heading {
  margin-bottom: 0;
}

.side-head {
  margin-bottom: 14px;
}

.link-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 10px;
  text-decoration: none;
  background: #f9fafb;
  border: 1px solid #f0f1f3;
  border-radius: 10px;
}

.link-preview:hover {
  border-color: var(--color-primary);
}

.link-thumb {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  overflow: hidden;
  background: #e5e7eb;
  border-radius: 8px;
}

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

.link-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary);
}

.link-text strong {
  font-size: 0.88rem;
  color: var(--color-tertiary-black);
  overflow-wrap: anywhere;
}

.save-flash {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-secondary-teal);
}

/* ---------------------------------------------------------------------
   Modals and sharing
   --------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.4);
}

.modal-card {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 28px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.modal-card.wide {
  max-width: 600px;
}

.modal-title {
  font-size: 1.25rem;
  margin-bottom: 18px;
}

.modal-subtitle {
  margin: -10px 0 18px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.share-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 6px 12px;
  font-size: 0.88rem;
  background: #f9fafb;
  border-radius: 10px;
}

.share-email {
  min-width: 0;
  overflow-wrap: anywhere;
}

.share-add-row {
  display: flex;
  gap: 8px;
}

.share-add-row .text-input {
  flex: 1;
  min-width: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #ffffff;
  background: #111827;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */

.powered-by a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #6b7280;
  font-size: 0.85rem;
  transition: color 0.15s ease;
}

.powered-by a:hover {
  color: var(--color-tertiary-black);
}

.powered-by-logo {
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

.powered-by strong {
  color: var(--color-primary);
  font-weight: 700;
}

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */

@media (max-width: 860px) {
  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .side-card {
    position: static;
  }
}

@media (max-width: 640px) {
  body {
    padding: 16px;
  }

  .card {
    padding: 20px;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .nav-email {
    max-width: 150px;
  }

  .task-toolbar .spacer {
    display: none;
  }

  .task-toolbar #addTaskBtn {
    width: 100%;
  }

  .text-select.compact {
    flex: 1;
    max-width: none;
  }

  .tag-manage {
    grid-template-columns: 1fr;
  }

  .modal-card {
    padding: 20px;
  }

  .share-add-row {
    flex-direction: column;
  }
}
