:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #2c7be5;
  --accent: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --shadow: 0 10px 30px rgba(0,0,0,0.08);
  --radius: 16px;
}

[data-theme="dark"] {
  --bg: #1e293b;
  --card: #0f172a;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --brand: #3b82f6;
  --accent: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --shadow: 0 10px 30px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.card {
  --card-padding-top: 28px;
  background: var(--card);
  border-radius: var(--radius);
  padding: var(--card-padding-top) 40px 42px 40px;
  margin: 0; /* grid gap handles spacing */
  position: relative;
  transition: all 0.3s ease;
  overflow: hidden;
  container-type: inline-size;
  border: none;
  box-shadow:
    0 8px 30px rgba(0,0,0,0.07),
    inset 0 0 0 2px rgba(255,255,255,0.5),
    inset 0 6px 20px rgba(255,255,255,0.5),
    inset 0 -6px 20px rgba(0,0,0,0.04),
    inset 6px 0 20px rgba(255,255,255,0.15),
    inset -6px 0 20px rgba(255,255,255,0.15);
}
/* Subtle glass shine on cards — just a hint, borders do the heavy lifting */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(
      165deg,
      rgba(255,255,255,0.12) 0%,
      rgba(255,255,255,0.03) 15%,
      transparent 35%
    );
  pointer-events: none;
  z-index: 0;
}
/* Dark mode cards */
[data-theme="dark"] .card {
  box-shadow:
    0 8px 30px rgba(0,0,0,0.35),
    inset 0 0 0 2px rgba(255,255,255,0.09),
    inset 0 6px 20px rgba(255,255,255,0.08),
    inset 0 -6px 20px rgba(0,0,0,0.15),
    inset 6px 0 20px rgba(255,255,255,0.04),
    inset -6px 0 20px rgba(255,255,255,0.04);
}
[data-theme="dark"] .card::before {
  background:
    linear-gradient(
      165deg,
      rgba(255,255,255,0.04) 0%,
      rgba(255,255,255,0.01) 15%,
      transparent 35%
    );
}
/* Elevate card content above glass shine */
.card > * {
  position: relative;
  z-index: 1;
}


/* Header and time tracking sections should never collapse */
.app-header.collapsed,
.time-tracking-card.collapsed {
  padding: 12px 40px 32px 40px !important;
  margin-bottom: 40px !important;
}

.app-header.collapsed > *,
.time-tracking-card.collapsed > * {
  display: block !important;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 57.6px 103.2192px 60.48px 103.2192px; /* -20% L/R and -50% bottom vs previous header padding */
}

/* Header (top section) has no outer gaps above or on sides */
.app-header.card {
  margin: 0 0 16px 0;
  border-radius: 0;
}
/* Company logo with transform support */
.company-logo-container {
  width: 216px;
  height: 126px;
  overflow: hidden;
  position: relative;
  cursor: default;
}

/* Only show pointer cursor in edit mode */
.card.editing .company-logo-container {
  cursor: pointer;
}

.company-logo-container .company-logo {
  position: absolute;
}

[data-theme="dark"] .company-logo {
  filter: brightness(1.3);
}

/* "Invert colors in dark mode" (per-icon and header-logo toggle): the SVG
   filter in index.html flips dark greys toward white in proportion and lifts
   dark colours to their light tone, keeping hue; bright pixels are untouched.
   Light mode shows the image unchanged. */
body[data-theme="dark"] .invert-dark {
  filter: url(#invert-dark-filter);
}
.edit-popover .invert-dark-toggle,
.image-editor-controls .invert-dark-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.image-editor-controls .invert-dark-toggle { margin: 0; font-size: 14px; }
.invert-dark-toggle[hidden] { display: none !important; }
.invert-dark-toggle .appearance-toggle-switch { flex-shrink: 0; }
.header-left { display: flex; flex-direction: column; align-items: flex-start; }
.header-right { display: flex; align-items: center; gap: 26px; }
.profile-name { font-weight: 700; font-size: 36px; }
.profile-title { color: var(--muted); font-size: 22px; }

/* Search bar in header */
.header-search-row {
  position: absolute;
  bottom: 20px;
  left: 103px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-container {
  position: relative;
  width: 260px;
}

.search-input {
  width: 100%;
  padding: 8px 32px 8px 36px;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}

.search-input::placeholder {
  color: var(--muted);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.15s ease;
  padding: 0;
}

.search-clear:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--text);
}

[data-theme="dark"] .search-input {
  background: #1e293b;
  border-color: #475569;
}

[data-theme="dark"] .search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .search-clear:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Search Results Container */
.search-results {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.search-results[hidden] {
  display: none;
}

.search-no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.search-no-results-icon {
  margin-bottom: 16px;
  opacity: 0.5;
}

.search-no-results p {
  font-size: 16px;
  margin: 0;
}

.search-no-results strong {
  color: var(--text);
}

/* Search Categories */
.search-category {
  margin-bottom: 32px;
}

.search-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.search-category-header svg {
  opacity: 0.7;
}

.search-count {
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

[data-theme="dark"] .search-category-header {
  border-color: #475569;
}

/* Search Items */
.search-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-items-icons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}

.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.search-item:hover {
  background: var(--bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.search-item:active {
  transform: translateY(0);
}

.search-item-icon {
  justify-content: flex-start;
}

.search-icon-preview {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-icon-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.search-icon-emoji {
  font-size: 24px;
  line-height: 1;
}

.search-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-item-title {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-domain {
  font-size: 12px;
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-preview {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-location {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Search highlight */
.search-highlight {
  background: rgba(251, 191, 36, 0.4);
  border-radius: 2px;
  padding: 0 1px;
}

[data-theme="dark"] .search-highlight {
  background: rgba(251, 191, 36, 0.3);
}

/* Card highlight when navigating from search */
.search-highlight-card {
  animation: search-card-pulse 2s ease-out;
}

@keyframes search-card-pulse {
  0% {
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.6), var(--shadow);
  }
  100% {
    box-shadow: var(--shadow);
  }
}

[data-theme="dark"] .search-item {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .search-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .search-count {
  background: #1e293b;
}

/* Search item left container (for items with links toggle) */
.search-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

/* Search links toggle button */
.search-links-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--brand);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.search-links-toggle:hover {
  background: var(--brand);
  color: white;
}

.search-links-toggle svg {
  width: 14px;
  height: 14px;
}

/* Header icons row */
.header-icons-row {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 0;
  z-index: 10;
}
.header-icons-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-icons-spacer {
  width: 40px;
}
.header-icons-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Calendar view button in header */
.calendar-view-toggle {
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}
.calendar-view-toggle:hover {
  color: var(--brand);
  transform: scale(1.1);
}
[data-theme="dark"] .calendar-view-toggle { color: var(--muted); }
[data-theme="dark"] .calendar-view-toggle:hover { color: var(--brand); }

/* Time tracking button in header */
.time-tracking-toggle {
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.time-tracking-toggle:hover {
  color: var(--brand);
  transform: scale(1.1);
}

/* Meetings button in header */
.meetings-toggle {
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.meetings-toggle:hover {
  color: var(--brand);
  transform: scale(1.1);
}

.meetings-toggle svg {
  width: 20px;
  height: 20px;
}

/* ============================================================
   TIME TRACKING (header stopwatch → slide-out card)
   Task list with live totals + a category donut. Sized like the Tasks card.
   ============================================================ */

/* Category chart colors: one fixed slot per category (validated categorical
   palette, light + dark steps). Uncategorized/Other are neutral. */
body {
  --task-cat-1: #2a78d6;
  --task-cat-2: #eb6834;
  --task-cat-3: #1baf7a;
  --task-cat-4: #eda100;
  --task-cat-5: #e87ba4;
  --task-cat-6: #008300;
  --task-cat-7: #4a3aa7;
  --task-cat-8: #e34948;
  --task-cat-none: #898781;
  --task-cat-other: #b3b1aa;
  --task-timer-live: #16a34a;
  --task-timer-btn: #16a34a;
}
[data-theme="dark"] {
  --task-cat-1: #3987e5;
  --task-cat-2: #d95926;
  --task-cat-3: #199e70;
  --task-cat-4: #c98500;
  --task-cat-5: #d55181;
  --task-cat-6: #008300;
  --task-cat-7: #9085e9;
  --task-cat-8: #e66767;
  --task-cat-none: #898781;
  --task-cat-other: #5f5e5a;
  --task-timer-live: #22c55e;
  --task-timer-btn: #15803d;
}

.time-tracking-card {
  max-width: calc(100% - 32px);
  position: relative;
  display: flex;
  flex-direction: column;
}
.time-tracking-card[hidden] { display: none; }
.time-tracking-card:not(.active) {
  opacity: 0;
  height: 0;
  padding: 0 !important;
  margin: 0 auto !important;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
}
.time-tracking-card.active {
  opacity: 1;
  margin: 0 auto 12px auto !important;
  padding: var(--card-padding-top) 40px 24px 40px !important;
  transition: opacity 0.2s ease-in;
}

.tt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.tt-header h3 {
  margin: 0;
  font-size: 24px;
}

/* Narrow panel (phone Time sheet, small windows): Tasks on top, Categories below */
.tt-body {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
/* Wide panel: Categories on the left at the chart's natural width, Tasks fill the rest */
@container (min-width: 960px) {
  .tt-body {
    flex-direction: row;
    align-items: flex-start;
    gap: 40px;
  }
  .tt-section-categories {
    order: -1;
    flex: 0 0 auto;
    max-width: 600px;
  }
  .tt-section-tasks {
    flex: 1 1 0;
    min-width: 0;
  }
}

/* Tasks heading + its sort button (right end of the heading row) */
.tt-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px 4px;
}
.tt-section-head .tt-section-heading { margin: 0; min-width: 0; }
.tt-sort-btn { flex-shrink: 0; }

.tt-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 4px;
}

/* --- Task rows */
.tt-task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tt-task {
  border-radius: 14px;
  background: var(--glass-reflection, none), var(--glass-field, rgba(255, 255, 255, 0.7));
  border: 1px solid var(--glass-edge, rgba(0, 0, 0, 0.06));
  box-shadow: var(--fx-lift-pill, 0 2px 8px rgba(0, 0, 0, 0.06)), var(--glass-rim, 0 0 0 transparent);
}
.tt-task.is-running {
  border-color: color-mix(in srgb, var(--task-timer-live) 55%, transparent);
}
.tt-task-line {
  position: relative;
  z-index: 0; /* own stacking context: the running crystal's halo stays above the row */
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto 64px;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 6px 6px;
}
.tt-task-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 4px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.tt-task-main > svg {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.tt-task-main[aria-expanded="true"] > svg { transform: rotate(90deg); }
.tt-task-heading { display: flex; align-items: center; min-width: 0; gap: 2px; }
.tt-task-heading .tt-task-main { flex: 1; }
.tt-subtasks-toggle {
  flex: 0 0 26px; width: 26px; height: 30px; display: grid; place-items: center;
  padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer;
}
.tt-subtasks-toggle[aria-expanded="true"] > svg { transform: rotate(90deg); }
.tt-subtasks-toggle:hover, .tt-task-main:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.tt-subtasks { margin: 0 14px 10px 20px; padding-left: 14px; border-left: 1px solid var(--glass-divider, #8884); }
.tt-subtasks[hidden] { display: none; }
.tt-subtask { display: grid; grid-template-columns: minmax(0, 1fr) 42px auto; gap: 10px; align-items: center; padding: 7px 0; }
.tt-subtask-name { min-width: 0; overflow-wrap: anywhere; font-size: 13px; color: var(--text); }
.tt-subtask-name .tt-task-tag { margin-left: 6px; font-size: 9px; }
.tt-subtask-share { text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tt-task-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tt-task.is-past .tt-task-title { color: var(--muted); }
.tt-task-tag {
  flex-shrink: 0;
  padding: 1px 6px;
  border: 1px solid var(--glass-divider, rgba(0, 0, 0, 0.12));
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.tt-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 150px;
  font-size: 12px;
  color: var(--muted);
}
.tt-cat-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tt-cat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tt-task-time {
  min-width: 62px;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
/* Complete + stopwatch (open tasks); empty but the same width on finished rows */
.tt-task-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.tt-task-complete.task-complete-btn {
  width: 30px;
  height: 30px;
  margin-block: 0;
}
.tt-task-complete.task-complete-btn svg {
  width: 18px;
  height: 18px;
}
.tt-task-toggle.task-timer-btn {
  width: 30px;
  height: 30px;
}
.tt-task-toggle.task-timer-btn svg {
  width: 17px;
  height: 17px;
}

/* Sessions (row expanded) */
.tt-sessions { padding: 0 14px 10px 36px; }
.tt-sessions[hidden] { display: none; }
.tt-session-list {
  display: flex;
  flex-direction: column;
  max-height: 220px;
  overflow-y: auto;
  border-top: 1px solid var(--glass-divider, rgba(0, 0, 0, 0.08));
}
.tt-session {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--glass-divider, rgba(0, 0, 0, 0.06));
  font-size: 12.5px;
  color: var(--muted);
}
.tt-session-range {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tt-session-duration {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.tt-session-delete {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s, color 0.15s, background-color 0.15s;
}
.tt-session-delete:hover {
  opacity: 1;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}
.tt-clear-btn {
  margin-top: 8px;
  padding: 2px 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
  cursor: pointer;
}
.tt-clear-btn:hover { text-decoration: underline; }
.task-editor-time-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.task-editor-time-actions .task-desc-edit-btn { color: var(--text); }
.tt-editor-history { margin-top: 12px; }
.tt-editor-history[hidden] { display: none; }
.tt-history-heading { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.tt-history-total { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.tt-history-sessions .tt-session { grid-template-columns: minmax(0, 1fr) auto 24px; gap: 4px 8px; padding: 9px 0; }
.tt-history-sessions .tt-session-day { grid-column: 1; }
.tt-history-sessions .tt-session-range { grid-column: 1; grid-row: 2; font-size: 11px; }
.tt-history-sessions .tt-session-duration { grid-column: 2; grid-row: 1 / 3; }
.tt-history-sessions :is(.tt-session-delete, .tt-session-spacer) { grid-column: 3; grid-row: 1 / 3; }
.tt-session-subtask { grid-column: 1 / -1; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.tt-history-body { padding: 16px 20px; overflow-y: auto; }
#task-time-history-modal .subtask-desc-dialog { width: min(560px, calc(100vw - 24px)); }
html[data-shell="mobile"] :is(.tt-editor-history, .tt-history-body) .tt-session-delete { width: 36px; height: 40px; }
html[data-shell="mobile"] .tt-history-sessions .tt-session { grid-template-columns: minmax(0, 1fr) auto 36px; }
html[data-shell="mobile"] .tt-history-sessions .tt-session-list { max-height: none; }
html[data-shell="mobile"] :is(.tt-clear-btn, #task-editor-history-toggle) { min-height: 44px; }
html[data-shell="mobile"] .tt-subtasks-toggle { flex-basis: 32px; width: 32px; height: 44px; }
/* Period filter on: how many of the task's sessions it hides */
.tt-sessions-outside {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* Completed / deleted tasks (collapsed by default) */
.tt-past-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px 8px 6px;
  border: none;
  border-radius: 10px;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.tt-past-toggle > svg { transition: transform 0.15s ease; }
.tt-past-toggle[aria-expanded="true"] > svg { transform: rotate(90deg); }
.tt-past-toggle-total {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.tt-past-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tt-past-group[hidden] { display: none; }
.tt-past-month + .tt-past-month {
  border-top: 1px solid var(--glass-divider, rgba(0, 0, 0, 0.08));
}
.tt-month-toggle {
  margin-top: 0;
  padding-block: 10px;
  color: var(--text);
}
.tt-month-label { min-width: 0; text-align: left; }
.tt-month-count { color: var(--muted); font-weight: 400; }
.tt-month-tasks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 10px 10px;
}
.tt-month-tasks[hidden] { display: none; }

/* Narrow cards (phone): drop the category chip, tighten the session grid.
   Placed after the base rules above so it wins. */
@container (max-width: 480px) {
  .tt-cat-chip { display: none; }
  .tt-task-line { grid-template-columns: minmax(0, 1fr) auto 64px; }
  .tt-sessions { padding: 0 8px 10px 12px; }
  .tt-session { grid-template-columns: auto minmax(0, 1fr) auto 22px; gap: 8px; }
}

/* --- Category donut */
.tt-chart {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}
.tt-donut {
  position: relative;
  width: 156px;
  height: 156px;
  flex-shrink: 0;
}
.tt-donut svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.tt-donut-slice {
  fill: none;
  stroke-width: 14px;
  cursor: pointer;
  outline: none;
  transition: stroke-width 0.15s ease, opacity 0.15s ease;
}
.tt-donut-slice.is-hover,
.tt-donut-slice:focus-visible { stroke-width: 17px; }
.tt-donut-slice.is-dimmed { opacity: 0.4; }
.tt-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}
.tt-donut-center strong {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
}
.tt-donut-center-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.tt-legend {
  flex: 0 1 380px;
  min-width: 190px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tt-legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto 40px;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  transition: background-color 0.15s ease;
}
.tt-legend-row.is-hover { background: var(--glass-hover, rgba(0, 0, 0, 0.05)); }
.tt-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}
.tt-legend-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tt-legend-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tt-legend-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.tt-chart-tooltip {
  position: absolute;
  z-index: 5;
  left: 0;
  top: 0;
  transform: translate(-50%, calc(-100% - 14px));
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--glass-edge, rgba(0, 0, 0, 0.08));
  background: var(--glass-reflection, none), var(--glass-dialog, #fff);
  box-shadow: 0 10px 28px -8px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  white-space: nowrap;
  pointer-events: none;
}
.tt-chart-tooltip.is-below { transform: translate(-50%, 18px); }
.tt-chart-tooltip[hidden] { display: none; }
.tt-tip-key {
  width: 3px;
  border-radius: 2px;
}
.tt-tip-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tt-tip-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.tt-tip-label {
  font-size: 12px;
  color: var(--muted);
}

/* --- Categories period filter (button on top of the legend + popover).
   The legend column takes the legend's old flex role; the button lines up
   with the legend rows' left edge. */
.tt-legend-col {
  flex: 0 1 380px;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.tt-legend-col .tt-legend {
  flex: none;
  align-self: stretch;
  min-width: 0;
}
/* Empty states: the button sits above the message */
.tt-category-chart > .tt-range-btn { margin-bottom: 4px; }
.tt-range-btn {
  min-width: 0;
  max-width: 100%;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 10px;
  border: 1px solid var(--glass-divider, rgba(0, 0, 0, 0.12));
  border-radius: 999px;
  background: var(--glass-field, #fff);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.tt-range-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.tt-range-btn-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tt-range-btn:hover { color: var(--text); }
.tt-range-btn.is-active { color: var(--brand); border-color: var(--brand); }
.tt-range-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.tt-range-pop {
  position: fixed;
  z-index: 9000;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.35);
}
/* Transform only: opacity on a glass pane cuts off its backdrop sampling */
.tt-range-pop.open { animation: qcIn 0.16s ease-out; }
.tt-range-label {
  padding: 0 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.tt-sort-pop { width: 240px; }
.tt-sort-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tt-range-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.tt-range-option {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 11px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: var(--glass-field, #f8fafc);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.tt-range-option-name { font-size: 13px; font-weight: 600; }
.tt-range-option-span {
  max-width: 100%;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tt-range-option[aria-pressed="true"] {
  color: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(66, 105, 155, 0.14);
}
.tt-range-option:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tt-range-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.tt-range-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tt-range-field-label { padding: 0 2px; font-size: 12px; color: var(--muted); }
.tt-range-date {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: var(--glass-field, #f8fafc);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tt-range-date:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(66, 105, 155, 0.18);
}
.tt-range-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}
.tt-range-clear {
  min-height: 34px;
  padding: 6px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tt-range-clear:hover:not(:disabled) { color: var(--text); background: rgba(0, 0, 0, 0.05); }
.tt-range-apply {
  min-height: 34px;
  padding: 6px 18px;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tt-range-apply:hover:not(:disabled) { filter: brightness(1.07); }
:is(.tt-range-clear, .tt-range-apply):disabled { opacity: 0.45; cursor: default; }
:is(.tt-range-clear, .tt-range-apply):focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* "Show all time" inside the empty-period message */
.tt-range-reset {
  padding: 0;
  border: none;
  background: none;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tt-range-reset:hover { text-decoration: underline; }

[data-theme="dark"] .tt-range-pop { border-color: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] :is(.tt-range-option, .tt-range-date) { border-color: rgba(255, 255, 255, 0.14); }
[data-theme="dark"] .tt-range-clear:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }

/* Header stopwatch: live dot while a timer runs */
.time-tracking-toggle { position: relative; }
.time-tracking-toggle.is-running { color: var(--text); }
.time-tracking-toggle.is-running::after {
  content: '';
  position: absolute;
  top: 1px;
  right: 1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--task-timer-live);
  box-shadow: 0 0 6px color-mix(in srgb, var(--task-timer-live) 70%, transparent);
  animation: tt-live-dot 2.4s ease-in-out infinite;
}
@keyframes tt-live-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .time-tracking-toggle.is-running::after { animation: none; }
}

/* Dark mode styles for time tracking */
[data-theme="dark"] .time-tracking-toggle {
  color: var(--muted);
}

[data-theme="dark"] .time-tracking-toggle:hover {
  color: var(--brand);
}
[data-theme="dark"] .time-tracking-toggle.is-running {
  color: var(--text);
}

/* Quick Link Modal (opened from the Today view, so it sits above it) */
.quick-link-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10005;
}

.quick-link-dialog {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.quick-link-dialog h3 {
  margin: 0 0 20px 0;
  font-size: 20px;
  color: var(--text);
}

.quick-link-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.quick-link-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.quick-link-field input {
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s ease;
}

.quick-link-field input:focus {
  outline: none;
  border-color: var(--brand);
}

.quick-link-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.quick-link-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-link-btn.primary {
  background: var(--brand);
  color: white;
  border: none;
}

.quick-link-btn.primary:hover {
  background: #1d4ed8;
}

.quick-link-btn.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid #e2e8f0;
}

.quick-link-btn.secondary:hover {
  background: var(--bg);
  color: var(--text);
}

.quick-link-btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  margin-right: auto;
}

.quick-link-btn.danger:hover {
  background: var(--danger);
  color: white;
}

.quick-link-btn.danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Dark mode for quick links */
[data-theme="dark"] .quick-link-dialog {
  background: var(--card);
}

[data-theme="dark"] .quick-link-field input {
  background: #1e293b;
  border-color: #475569;
}

[data-theme="dark"] .quick-link-btn.secondary {
  border-color: #475569;
}

[data-theme="dark"] .quick-link-btn.secondary:hover {
  background: #334155;
}

[data-theme="dark"] .meetings-toggle {
  color: var(--muted);
}

[data-theme="dark"] .meetings-toggle:hover {
  color: var(--brand);
}

.app-main {
  max-width: 1260px;
  margin: 0 auto;
  position: relative;
  padding: 0 16px 40px 16px;
  display: grid;
  /* JS overrides grid-template-columns and grid-auto-rows with px values via applyCellSize() */
  grid-template-columns: repeat(24, 1fr); /* fallback; JS sets px values */
  grid-auto-rows: auto;
  gap: 16px;
  /* Cards FILL their assigned grid area — white space lives inside the card,
     making view mode pixel-identical to the edit-mode preview */
  align-items: stretch;
  --grid-gap: 16px;
  /* The grid engine measures the container right after changing its zoom and
     columns (edit-mode toggle, applyCellSize). The reduced-motion rule in
     glass.css gives every property a 0.01ms transition, which kept the old
     zoom for one frame: leaving edit mode then sized the cards for the
     zoomed-out grid and they clipped. Its geometry never transitions */
  transition-property: none;
}
/* Header: pinned to grid row 1, which is auto-height (grid-template-rows: auto).
   Data cards live in rows 2+ which are uniform square cells. */
.app-main > .app-header {
  grid-column: 1 / -1;
  grid-row: 1;
}
/* Default card spans full width */
.app-main > .card {
  grid-column: span 24;
  margin: 0; /* grid gap handles spacing */
}

h2, h3 { margin: 0 0 16px; }
/* Unify section title styles and increase spacing */
.card > h2, .card > h3, .card .section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

/* Section title wrapper for title + optional color picker */
.section-title-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

/* Color picker button next to main title (for _default items) */
.title-color-picker-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-color-picker-btn:hover {
  opacity: 1;
}

/* Reorder subtitles button */
.reorder-subtitles-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.reorder-subtitles-btn:hover {
  opacity: 1;
  color: var(--brand);
}

/* Reorder Subtitles Modal */
.reorder-subtitles-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.reorder-modal-content {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  min-width: 280px;
  max-width: 400px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.reorder-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.reorder-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.reorder-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.reorder-modal-close:hover {
  color: var(--text);
}

.reorder-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
}

.reorder-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.reorder-subtitles-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.reorder-subtitle-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: #f7fafc;
  border-radius: 8px;
  cursor: grab;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  user-select: none;
}

.reorder-subtitle-item:hover {
  background: #edf2f7;
}

.reorder-subtitle-item.dragging {
  opacity: 0.5;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.reorder-subtitle-item.drag-over {
  background: #dbeafe;
  border: 2px dashed var(--brand);
}

.reorder-drag-handle {
  color: var(--muted);
  display: flex;
  align-items: center;
}

.reorder-subtitle-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.reorder-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
}

/* Dark theme for reorder modal */
[data-theme="dark"] .reorder-modal-header {
  border-color: #475569;
}

[data-theme="dark"] .reorder-subtitle-item {
  background: #334155;
}

[data-theme="dark"] .reorder-subtitle-item:hover {
  background: #3d4f65;
}

[data-theme="dark"] .reorder-subtitle-item.drag-over {
  background: #1e3a5f;
  border-color: var(--brand);
}

[data-theme="dark"] .reorder-modal-footer {
  border-color: #475569;
}

/* Main reminders container - no grid layout, just holds subtitle groups */
.reminders-container { 
  display: block; 
}

/* Container for reminder items under a specific subtitle */
.reminder-subtitle-container { 
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 12px 24px; 
  margin-bottom: 16px;
}

/* Legacy class for backward compatibility */
.reminder-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }


.reminder-item {
  display: flex; align-items: center; justify-content: space-between;
  background: #f7fafc; border-radius: 999px; padding: 12px 16px 12px 29px; border: 1px solid rgba(255,255,255,0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.06),
    0 8px 30px rgba(0,0,0,0.04),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}
/* Glass cover for pill items */
.reminder-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(
      ellipse 25% 70% at 12% 30%,
      rgba(255,255,255,0.55) 0%,
      rgba(255,255,255,0.18) 40%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 90% 50% at 50% -10%,
      rgba(255,255,255,0.65) 0%,
      rgba(255,255,255,0.3) 35%,
      rgba(255,255,255,0.06) 60%,
      transparent 80%
    ),
    linear-gradient(
      160deg,
      rgba(255,255,255,0.45) 0%,
      rgba(255,255,255,0.15) 25%,
      transparent 50%,
      rgba(255,255,255,0.02) 75%,
      rgba(255,255,255,0.08) 100%
    );
  pointer-events: none;
  z-index: 1;
}
.reminder-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.4),
    inset 0 2px 4px rgba(255,255,255,0.55),
    inset 0 -2px 4px rgba(0,0,0,0.04),
    inset 2px 0 4px rgba(255,255,255,0.1),
    inset -2px 0 4px rgba(255,255,255,0.1);
  pointer-events: none;
  z-index: 2;
}
.reminder-item:hover:not(.add-tile) {
  transform: scale(1.03);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.08),
    0 10px 35px rgba(0,0,0,0.05),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}
.reminder-title { font-weight: 600; font-size: 16px; color: inherit; text-decoration: none; }
.reminder-title:hover { text-decoration: none; }
.days-badge {
  min-width: 92px; text-align: center; font-weight: 400;
  padding: 6px 10px; border-radius: 999px; color: #111827;
  background: #e5e7eb;
}
.days-green { background: #bbf7d0; }
.days-warn { background: #fde68a; }
.days-orange { background: #fed7aa; }
.days-danger { background: #fecaca; }

/* Interval mode color classes */
.green { background: #bbf7d0; }
.yellow { background: #fde68a; }
.orange { background: #fed7aa; }
.red { background: #fecaca; }

/* Glowing badges — light bleeding through glass (light glass mode only) */
body[data-style="glass"]:not([data-theme="dark"]) .days-green,
body[data-style="glass"]:not([data-theme="dark"]) .green {
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.35), 0 0 3px rgba(34, 197, 94, 0.2);
}
body[data-style="glass"]:not([data-theme="dark"]) .days-warn,
body[data-style="glass"]:not([data-theme="dark"]) .yellow {
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.4), 0 0 3px rgba(234, 179, 8, 0.25);
}
body[data-style="glass"]:not([data-theme="dark"]) .days-orange,
body[data-style="glass"]:not([data-theme="dark"]) .orange {
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.35), 0 0 3px rgba(249, 115, 22, 0.2);
}
body[data-style="glass"]:not([data-theme="dark"]) .days-danger,
body[data-style="glass"]:not([data-theme="dark"]) .red {
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.35), 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Original icon-grid rule removed - using the one with !important below */
.icon-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.icon-separator { height: 42px; }
.icon-separator--wide { padding: 0 24px; }

/* Ensure separators are clickable in edit mode */
.icon-separator.editable {
  cursor: pointer !important;
  pointer-events: auto !important;
  user-select: none;
  width: 84px !important;
  height: 84px !important;
  padding: 8px !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.icon-button {
  width: 84px; height: 84px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 14px; background: #f8fafc; border: 1px solid rgba(255,255,255,0.35);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.06),
    0 8px 30px rgba(0,0,0,0.04),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03),
    inset 3px 0 8px rgba(0,0,0,0.01),
    inset -3px 0 8px rgba(0,0,0,0.01);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
/* Glass cover: shine gradient + reflection arc + specular highlight */
.icon-button::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    /* Specular hot-spot — feathered glow top-left */
    radial-gradient(
      ellipse 40% 30% at 28% 18%,
      rgba(255,255,255,0.75) 0%,
      rgba(255,255,255,0.25) 40%,
      transparent 75%
    ),
    /* Reflection arc — wide elliptical highlight near top */
    radial-gradient(
      ellipse 80% 45% at 50% -8%,
      rgba(255,255,255,0.7) 0%,
      rgba(255,255,255,0.35) 35%,
      rgba(255,255,255,0.08) 60%,
      transparent 75%
    ),
    /* Diagonal shine sweep */
    linear-gradient(
      140deg,
      rgba(255,255,255,0.5) 0%,
      rgba(255,255,255,0.18) 30%,
      transparent 50%,
      rgba(255,255,255,0.02) 70%,
      rgba(255,255,255,0.1) 100%
    );
  pointer-events: none;
  z-index: 2;
}
/* Feathered glass rim — glossy inner border */
.icon-button::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.4),
    inset 0 2px 4px rgba(255,255,255,0.6),
    inset 0 -2px 4px rgba(0,0,0,0.05),
    inset 2px 0 4px rgba(255,255,255,0.15),
    inset -2px 0 4px rgba(255,255,255,0.15);
  border: none;
  pointer-events: none;
  z-index: 3;
}
.icon-button:hover {
  transform: scale(1.02);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.08),
    0 10px 35px rgba(0,0,0,0.05),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03),
    inset 3px 0 8px rgba(0,0,0,0.01),
    inset -3px 0 8px rgba(0,0,0,0.01);
}
.icon-button img { width: 48px; height: 48px; object-fit: contain; }
.icon-button .icon-emoji {
  font-size: 40px;
  line-height: 1;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
}

/* Icons in Quick Access carry an animated light inside their glass rim. */
.icon-button.icon-in-quick-access {
  border-color: transparent;
}

.section-icon img { width: 66px; height: 66px; }

/* Hide section icon completely when card is collapsed */
.analytics-wrapper {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 32px;
  align-items: start;
}

.list-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 8px; }
.list-item {
  background: #fff4e5; border: 1px solid rgba(255,255,255,0.35); border-radius: 999px; padding: 12px 16px 12px 29px; font-weight: 600;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.06),
    0 8px 30px rgba(0,0,0,0.04),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}
.list-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(
      ellipse 25% 70% at 12% 30%,
      rgba(255,255,255,0.55) 0%,
      rgba(255,255,255,0.18) 40%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 90% 50% at 50% -10%,
      rgba(255,255,255,0.65) 0%,
      rgba(255,255,255,0.3) 35%,
      rgba(255,255,255,0.06) 60%,
      transparent 80%
    ),
    linear-gradient(
      160deg,
      rgba(255,255,255,0.45) 0%,
      rgba(255,255,255,0.15) 25%,
      transparent 50%,
      rgba(255,255,255,0.02) 75%,
      rgba(255,255,255,0.08) 100%
    );
  pointer-events: none;
  z-index: 1;
}
.list-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.4),
    inset 0 2px 4px rgba(255,255,255,0.55),
    inset 0 -2px 4px rgba(0,0,0,0.04),
    inset 2px 0 4px rgba(255,255,255,0.1),
    inset -2px 0 4px rgba(255,255,255,0.1);
  pointer-events: none;
  z-index: 2;
}
.list-item:hover:not(.add-tile) {
  transform: translateY(-1px);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.08),
    0 10px 35px rgba(0,0,0,0.05),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}
.list-item.tools { background: #e6fff3; border-color: #c6f7e2; }
.list-item.add-tile {
  padding: 12px 16px 12px 29px !important;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  font-weight: 600;
  background: #eef2ff;
  border: 0.7px solid #c7d2fe;
}

#dark-mode-toggle svg {
  position: absolute;
  transition: opacity 0.2s ease;
}
#dark-mode-toggle .icon-light { opacity: 0; }
#dark-mode-toggle .icon-dark { opacity: 1; }
#dark-mode-toggle.active .icon-light { opacity: 1; }
#dark-mode-toggle.active .icon-dark { opacity: 0; }

.wrench-btn {
  position: fixed; right: 20px; bottom: 20px; width: 62px; height: 62px;
  border: none; border-radius: 50%; background: #ffffff; box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer;
  transition: all 0.2s ease;
  z-index: 9999;
}
.wrench-btn:hover { transform: scale(1.05); }
.wrench-btn svg { width: 22px; height: 22px; color: var(--text); }
.wrench-btn.active { outline: 3px solid #60a5fa; }

[data-theme="dark"] .wrench-btn {
  background: #1e293b;
}

/* Floating action group for global accept/cancel */
.fab-group {
  position: fixed;
  right: 27px;
  bottom: 94px;
  display: none;
  gap: 10px;
  flex-direction: column;
  z-index: 1000;
}
.fab-group:not([hidden]) { display: flex; }
.fab {
  width: 48px; height: 48px; border-radius: 999px; border: none;
  cursor: pointer; font-weight: 900; font-size: 20px; display: grid; place-items: center;
  transition: all 0.2s ease;
  position: relative;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.1),
    inset 0 0 0 1.5px rgba(255,255,255,0.5),
    inset 0 2px 6px rgba(255,255,255,0.6),
    inset 0 -3px 8px rgba(0,0,0,0.05),
    inset 3px 0 6px rgba(255,255,255,0.15),
    inset -3px 0 6px rgba(255,255,255,0.15);
}
.fab::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 50% 50% at 35% 20%, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.1) 50%, transparent 80%),
    linear-gradient(155deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.05) 30%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}
.fab:hover { transform: scale(1.1); }
.fab-accept {
  background: #6ee7b7;
  color: #064e3b;
  font-size: 20px;
  font-weight: 900;
  position: relative;
}
.fab-accept[data-checkmark="true"]::after {
  content: '';
  position: absolute;
  top: 46%;
  left: 50%;
  width: 14px;
  height: 6px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: translate(-50%, -50%) rotate(-45deg);
}
.fab-cancel { background: #fca5a5; color: #7f1d1d; }
[data-theme="dark"] .fab-accept {
  background: #064e3b;
  color: #a7f3d0;
}
[data-theme="dark"] .fab-cancel {
  background: #7f1d1d;
  color: #fecaca;
}
[data-theme="dark"] .fab {
  box-shadow:
    0 4px 16px rgba(0,0,0,0.3),
    inset 0 0 0 1.5px rgba(255,255,255,0.1),
    inset 0 2px 6px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.15),
    inset 3px 0 6px rgba(255,255,255,0.04),
    inset -3px 0 6px rgba(255,255,255,0.04);
}
[data-theme="dark"] .fab::before {
  background:
    radial-gradient(ellipse 50% 50% at 35% 20%, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.06) 50%, transparent 80%),
    linear-gradient(155deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.03) 30%, transparent 55%);
}

/* Restore FAB (bottom-left) */
.fab-left {
  position: fixed; left: 20px; bottom: 20px; width: 48px; height: 48px;
  border: none; border-radius: 50%; background: #e5e7eb; color: #374151; box-shadow: var(--shadow);
  display: none; place-items: center; cursor: pointer; font-size: 20px;
  transition: all 0.2s ease;
}
.fab-left:not([hidden]) { display: grid; }
.fab-left:hover { transform: scale(1.05); background: #d1d5db; }
.fab-left svg { width: 20px; height: 20px; stroke: currentColor; }
.fab-left-up { bottom: 74px; }
.fab-left-up2 { bottom: 128px; }
.fab-left-up3 { bottom: 182px; }

/* Sticky Note Container */
.sticky-note-container {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 500;
}
.sticky-note-container[hidden] {
  display: none;
}

/* Sticky Note Button (bottom-left, only visible outside edit mode) */
.sticky-note-btn {
  position: relative;
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  cursor: grab;
  transition: all 0.2s ease;
  padding: 0;
  overflow: hidden;
}
.sticky-note-btn:hover {
  transform: scale(1.05);
}
.sticky-note-btn:active {
  cursor: grabbing;
}
.sticky-note-icon {
  width: 38px;
  height: 38px;
  pointer-events: none;
}
.sticky-icon-body { fill: var(--sticky-icon-body, rgba(249, 237, 128, 0.5)); }
.sticky-icon-divider { stroke: var(--sticky-icon-divider, rgba(226, 203, 106, 0.4)); }

/* Sticky icon color variants */
.sticky-note-btn.sticky-yellow {
  --sticky-icon-body: rgba(249, 237, 128, 0.5);
  --sticky-icon-divider: rgba(226, 203, 106, 0.4);
}
.sticky-note-btn.sticky-purple {
  --sticky-icon-body: rgba(200, 170, 230, 0.5);
  --sticky-icon-divider: rgba(180, 150, 210, 0.4);
}
.sticky-note-btn.sticky-green {
  --sticky-icon-body: rgba(160, 220, 180, 0.5);
  --sticky-icon-divider: rgba(140, 200, 160, 0.4);
}
.sticky-note-btn.sticky-blue {
  --sticky-icon-body: rgba(160, 200, 240, 0.5);
  --sticky-icon-divider: rgba(140, 180, 220, 0.4);
}

[data-theme="dark"] .sticky-note-btn {
  background: #1e293b;
}

/* Sticky Note Color Picker */
.sticky-color-picker {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 160px;
  height: 130px;
  pointer-events: none;
}
.sticky-note-container:hover .sticky-color-picker {
  pointer-events: auto;
}
.sticky-color-btn {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 501;
  transition: opacity 0.2s ease;
}
.sticky-color-btn:hover {
  border-color: rgba(255, 255, 255, 1);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}
.sticky-color-btn.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand), 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Color button colors and positions (fixed positions, no transform animation) */
.sticky-color-btn[data-color="yellow"] {
  background: #f9ed80;
  bottom: 73px;
  left: 30px;
}
.sticky-color-btn[data-color="purple"] {
  background: #e0c8f0;
  bottom: 58px;
  left: 55px;
}
.sticky-color-btn[data-color="green"] {
  background: #c8f0d4;
  bottom: 37px;
  left: 76px;
}
.sticky-color-btn[data-color="blue"] {
  background: #c8e0f5;
  bottom: 12px;
  left: 89px;
}

/* Expanded state - all colors visible at once */
.sticky-note-container:hover .sticky-color-btn {
  opacity: 1;
  pointer-events: auto;
}
.sticky-note-container:hover .sticky-color-btn[data-color="yellow"] { transition-delay: 0s; }
.sticky-note-container:hover .sticky-color-btn[data-color="purple"] { transition-delay: 0.04s; }
.sticky-note-container:hover .sticky-color-btn[data-color="green"] { transition-delay: 0.08s; }
.sticky-note-container:hover .sticky-color-btn[data-color="blue"] { transition-delay: 0.12s; }

/* Sticky Note Drag Preview */
/* Drag Preview */
.sticky-note-preview {
  position: fixed;
  width: 238px;
  height: 238px;
  background: var(--sticky-glass, rgba(249, 237, 128, 0.35));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--sticky-glass-border, rgba(249, 237, 128, 0.4));
  border-radius: 16px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    inset 0 1px 2px rgba(255,255,255,0.6);
  z-index: 99999;
  pointer-events: none;
  opacity: 0.75;
  transform: rotate(-2deg);
}
.sticky-note-preview .sticky-note-header {
  height: 18%;
  background: transparent;
  border-bottom: 1px solid var(--sticky-glass-divider, rgba(249, 237, 128, 0.3));
}
.sticky-note-preview .sticky-note-body {
  height: 82%;
}

/* Actual Sticky Note — Glassmorphism */
.sticky-note {
  position: absolute;
  width: 238px;
  height: 238px;
  background: var(--sticky-glass, rgba(249, 237, 128, 0.35));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--sticky-glass-border, rgba(249, 237, 128, 0.4));
  border-radius: 16px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    inset 0 1px 2px rgba(255,255,255,0.6),
    inset 0 -2px 6px rgba(0,0,0,0.03);
  z-index: 500;
  transform: rotate(-1deg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
}
/* Glass shine overlay */
.sticky-note::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(
      ellipse 50% 35% at 35% 12%,
      rgba(255,255,255,0.5) 0%,
      rgba(255,255,255,0.15) 45%,
      transparent 75%
    ),
    linear-gradient(
      155deg,
      rgba(255,255,255,0.35) 0%,
      rgba(255,255,255,0.1) 30%,
      transparent 55%,
      rgba(255,255,255,0.04) 80%,
      rgba(255,255,255,0.08) 100%
    );
  pointer-events: none;
  z-index: 1;
}
/* Glass rim highlight */
.sticky-note::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.35),
    inset 0 2px 4px rgba(255,255,255,0.45),
    inset 0 -2px 4px rgba(0,0,0,0.04);
  pointer-events: none;
  z-index: 2;
}
.sticky-note-header {
  height: 10%;
  background: transparent;
  position: relative;
  border-bottom: 1px solid var(--sticky-glass-divider, rgba(249, 237, 128, 0.3));
}

/* Sticky Note Color Variants — Glass tints */
.sticky-note-preview.sticky-yellow,
.sticky-note.sticky-yellow {
  --sticky-glass: rgba(249, 237, 128, 0.35);
  --sticky-glass-border: rgba(249, 237, 128, 0.45);
  --sticky-glass-divider: rgba(226, 203, 106, 0.3);
}
.sticky-note-preview.sticky-purple,
.sticky-note.sticky-purple {
  --sticky-glass: rgba(200, 170, 230, 0.35);
  --sticky-glass-border: rgba(200, 170, 230, 0.45);
  --sticky-glass-divider: rgba(180, 150, 210, 0.3);
}
.sticky-note-preview.sticky-green,
.sticky-note.sticky-green {
  --sticky-glass: rgba(160, 220, 180, 0.35);
  --sticky-glass-border: rgba(160, 220, 180, 0.45);
  --sticky-glass-divider: rgba(140, 200, 160, 0.3);
}
.sticky-note-preview.sticky-blue,
.sticky-note.sticky-blue {
  --sticky-glass: rgba(160, 200, 240, 0.35);
  --sticky-glass-border: rgba(160, 200, 240, 0.45);
  --sticky-glass-divider: rgba(140, 180, 220, 0.3);
}

/* Dark mode glass tints */
[data-theme="dark"] .sticky-note.sticky-yellow,
[data-theme="dark"] .sticky-note-preview.sticky-yellow {
  --sticky-glass: rgba(180, 170, 60, 0.3);
  --sticky-glass-border: rgba(180, 170, 60, 0.35);
  --sticky-glass-divider: rgba(160, 150, 50, 0.25);
}
[data-theme="dark"] .sticky-note.sticky-purple,
[data-theme="dark"] .sticky-note-preview.sticky-purple {
  --sticky-glass: rgba(140, 100, 180, 0.3);
  --sticky-glass-border: rgba(140, 100, 180, 0.35);
  --sticky-glass-divider: rgba(120, 80, 160, 0.25);
}
[data-theme="dark"] .sticky-note.sticky-green,
[data-theme="dark"] .sticky-note-preview.sticky-green {
  --sticky-glass: rgba(80, 160, 100, 0.3);
  --sticky-glass-border: rgba(80, 160, 100, 0.35);
  --sticky-glass-divider: rgba(60, 140, 80, 0.25);
}
[data-theme="dark"] .sticky-note.sticky-blue,
[data-theme="dark"] .sticky-note-preview.sticky-blue {
  --sticky-glass: rgba(80, 140, 200, 0.3);
  --sticky-glass-border: rgba(80, 140, 200, 0.35);
  --sticky-glass-divider: rgba(60, 120, 180, 0.25);
}
[data-theme="dark"] .sticky-note {
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -2px 6px rgba(0,0,0,0.1);
}
[data-theme="dark"] .sticky-note::before {
  background:
    radial-gradient(
      ellipse 50% 35% at 35% 12%,
      rgba(255,255,255,0.15) 0%,
      rgba(255,255,255,0.05) 45%,
      transparent 75%
    ),
    linear-gradient(
      155deg,
      rgba(255,255,255,0.1) 0%,
      rgba(255,255,255,0.03) 30%,
      transparent 55%,
      rgba(255,255,255,0.02) 80%,
      rgba(255,255,255,0.04) 100%
    );
}
[data-theme="dark"] .sticky-note::after {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.08),
    inset 0 2px 4px rgba(255,255,255,0.1),
    inset 0 -2px 4px rgba(0,0,0,0.15);
}

.sticky-note-delete {
  position: absolute;
  top: 2px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: rgba(0,0,0,0.4);
  font-size: 21px;
  font-weight: bold;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}
.sticky-note-delete:hover {
  color: #c00;
}
[data-theme="dark"] .sticky-note-delete {
  color: rgba(255,255,255,0.4);
}
[data-theme="dark"] .sticky-note-delete:hover {
  color: #f87171;
}
.sticky-note-body {
  height: 90%;
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  color: #1f2937;
  outline: none;
  overflow: hidden;
  word-wrap: break-word;
  position: relative;
  z-index: 1;
}
[data-theme="dark"] .sticky-note-body {
  color: #f1f5f9;
}
.sticky-note-body:empty:before {
  content: attr(placeholder);
  color: rgba(0,0,0,0.3);
  pointer-events: none;
}
[data-theme="dark"] .sticky-note-body:empty:before {
  color: rgba(255,255,255,0.3);
}
.sticky-note-body:focus {
  outline: none;
}

/* Reminder edit buttons */
.calendar-btn,
.hashtag-btn {
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 4px;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.calendar-btn:hover,
.hashtag-btn:hover {
  transform: scale(1.1);
}
.calendar-btn svg {
  width: 16px;
  height: 16px;
  stroke: var(--text);
}
.hashtag-btn {
  font-size: 16px;
  font-weight: bold;
  color: var(--text);
}

/* Edit popover */
.edit-popover {
  position: absolute; width: 320px; background: var(--card);
  border-radius: 12px; box-shadow: var(--shadow); padding: 14px; border: 1px solid #e5e7eb;
  z-index: 2500; /* above the card-edit-modal (2000) so items are editable inside it */
}
.edit-popover form { position: relative; }
.edit-popover label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.edit-popover input, .edit-popover select { padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 14px; background: var(--card); color: var(--text); }
.field-link-type { margin-bottom: 10px; }
.field-link-type label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
/* Keep the chevron separate from the field background so glass fills cannot
   erase it. The native select retains keyboard and pointer interaction. */
.link-type-select { position: relative; display: block; }
.field-link-type select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px; /* keep text clear of the chevron */
}
.link-type-select > svg {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.file-upload-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.file-upload-row .btn { padding: 6px 12px; font-size: 12px; }
.file-upload-row .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.edit-popover textarea {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  max-height: 200px;
  width: 100%;
  box-sizing: border-box;
}
.edit-popover input.disabled-sum-mode {
  background: #f3f4f6 !important;
  cursor: not-allowed !important;
  color: #6b7280;
}
.edit-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.btn-accept, .btn-cancel, .btn-delete, .btn-breakdown {
  width: 36px; height: 36px; border: none; cursor: pointer; font-weight: 800; font-size: 16px;
}
.btn-accept, .btn-cancel {
  border-radius: 999px;
  display: grid;
  place-items: center;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.1),
    inset 0 0 0 1.5px rgba(255,255,255,0.5),
    inset 0 2px 6px rgba(255,255,255,0.6),
    inset 0 -3px 8px rgba(0,0,0,0.06),
    inset 3px 0 6px rgba(255,255,255,0.15),
    inset -3px 0 6px rgba(255,255,255,0.15);
  transition: all 0.2s ease;
}
.btn-accept:hover, .btn-cancel:hover { transform: scale(1.1); }
.btn-accept { background: #d1fae5; color: #065f46; }
.btn-cancel { background: #fee2e2; color: #7f1d1d; }
#edit-cancel { padding: 0; line-height: 1; }
#edit-cancel > svg { display: block; }
.btn-delete, .btn-breakdown { border-radius: 8px; }
.btn-delete { background: transparent; color: #6b7280; }
.btn-delete:hover { color: #111827; }
.btn-breakdown {
  background: #dbeafe;
  color: var(--brand);
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}
.btn-breakdown:hover { background: #bfdbfe; transform: scale(1.05); }
.btn-breakdown svg { width: 18px; height: 18px; }

/* Move button */
.btn-move {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: #6b7280;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}
.btn-move:hover { color: #4338ca; transform: scale(1.05); }
.btn-move svg { width: 16px; height: 16px; }
[data-theme="dark"] .btn-move {
  color: #9ca3af;
}
[data-theme="dark"] .btn-move:hover {
  color: #c7d2fe;
}

/* Edit actions spacer - pushes accept/cancel to the right */
.edit-actions-spacer {
  flex: 1;
}

/* Move card selector dropdown */
.move-card-selector {
  position: absolute;
  bottom: 52px;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  max-height: 260px;
  overflow-y: auto;
  z-index: 10;
}
[data-theme="dark"] .move-card-selector {
  border-color: #475569;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
}
.move-card-selector-title {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  background: var(--card);
}
[data-theme="dark"] .move-card-selector-title {
  border-color: #475569;
}
.move-card-list {
  padding: 4px;
}
.move-card-option {
  display: block;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: background 0.15s ease;
}
.move-card-option:hover {
  background: #f3f4f6;
}
[data-theme="dark"] .move-card-option:hover {
  background: #334155;
}

/* Move list: a card glyph marks every card; a card with sections is a header and its
   sections sit indented beneath it on a tree rail ("This card" = the item's own card) */
.move-card-row,
.move-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.move-card-row { font-weight: 600; }
.move-card-row::before,
.move-card-header::before {
  content: '';
  flex: none;
  width: 12px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  opacity: 0.5;
}
.move-card-header {
  padding: 10px 12px 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid #e5e7eb;
  margin-top: 4px;
}
.move-card-list > :first-child { border-top: none; margin-top: 0; }
[data-theme="dark"] .move-card-header {
  border-color: #475569;
}
.move-card-header-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.move-card-header-tag {
  flex: none;
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(127, 127, 127, 0.14);
}

/* Section options (indented under their card header, on a tree rail) */
.move-subtitle-option {
  position: relative;
  padding-left: 34px !important;
  font-size: 13px;
}
.move-subtitle-option::before,
.move-subtitle-option::after {
  content: '';
  position: absolute;
  left: 18px;
  opacity: 0.22;
  pointer-events: none;
}
.move-subtitle-option::before {
  top: 0;
  bottom: 0;
  border-left: 1.5px solid currentColor;
}
.move-subtitle-option:last-child::before,
.move-subtitle-option:has(+ .move-card-header, + .move-card-row)::before {
  bottom: 50%;
}
.move-subtitle-option::after {
  top: 50%;
  width: 8px;
  border-top: 1.5px solid currentColor;
}
.move-subtitle-option.is-top {
  font-style: italic;
  color: var(--muted);
}
.move-card-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
}

/* Emoji picker container in edit popover */
.emoji-picker-container {
  margin-top: 10px;
  border-radius: 8px;
  overflow: hidden;
}
.emoji-picker-container emoji-picker {
  width: 100%;
  --num-columns: 8;
  --emoji-size: 1.3rem;
  --background: var(--card);
  --border-color: #e5e7eb;
  --indicator-color: var(--brand);
  --input-border-color: #e5e7eb;
  --input-font-color: var(--text);
  --input-placeholder-color: var(--muted);
  --outline-color: var(--brand);
  --category-font-color: var(--muted);
  --button-active-background: #e5e7eb;
  --button-hover-background: #f3f4f6;
}
[data-theme="dark"] .emoji-picker-container emoji-picker {
  --background: #1e293b;
  --border-color: #475569;
  --input-border-color: #475569;
  --button-active-background: #374151;
  --button-hover-background: #334155;
}
/* Image row with emoji button */
.image-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
#choose-emoji {
  font-size: 18px;
  padding: 6px 10px;
  min-width: auto;
}

#edit-icon-links {
  padding: 6px 10px;
  min-width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#edit-icon-links svg {
  width: 16px;
  height: 16px;
}

/* Simple confirm popover for restore */
.confirm-popover {
  position: fixed; left: 20px; bottom: 84px; width: 320px; background: var(--card);
  border-radius: 12px; box-shadow: var(--shadow); padding: 14px; border: 1px solid #e5e7eb;
}
.confirm-text { margin-bottom: 8px; color: var(--text); }

/* Calendar popover for reminder scheduling */
.calendar-popover {
  position: fixed; width: 320px; background: var(--card);
  border-radius: 12px; box-shadow: var(--shadow); border: 1px solid #e5e7eb;
  z-index: 2500; max-height: calc(100vh - 20px); overflow-y: auto; /* above card-edit-modal */
}
/* Interval popover shares calendar styling but ensure it also sits above the modal */
.interval-popover {
  z-index: 2500;
}
.calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px; border-bottom: 1px solid #e5e7eb;
}
.calendar-header h4 { margin: 0; font-size: 16px; font-weight: 600; }
.calendar-body { padding: 14px; }
.calendar-section {
  display: grid; gap: 6px; margin-bottom: 12px;
}
.calendar-section label {
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.calendar-section input,
.calendar-section select {
  padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 14px;
}
.calendar-section select { background: white; }

/* Calendar popover action buttons */
.calendar-popover .edit-actions {
  padding: 14px;
  justify-content: flex-end;
}
.calendar-popover .btn-accept,
.calendar-popover .btn-cancel {
  border-radius: 50%;
}

/* Toast */
/* Above every modal (Today, calendar, task editor), so feedback is never hidden */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100150;
  background: rgba(17,24,39,0.92); color: white; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow);
}

.btn { border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 12px; background: #fff; cursor: pointer; }
.btn.primary { background: var(--brand); color: white; border-color: var(--brand); }
.btn.danger { background: var(--danger); color: white; border-color: var(--danger); }
.muted { color: var(--muted); font-size: 12px; }
.image-row { display: flex; align-items: center; gap: 10px; }

/* Edit-mode highlighting */
.editable { position: relative; }
.editable.editing { /* outline removed - user is aware of editable items */ }

/* Per-section add (+) button shown in edit mode */
.section-plus {
  position: absolute; right: 56px; top: 16px; width: 32px; height: 32px;
  border-radius: 999px; border: none; background: #eef2ff; color: #3730a3; font-weight: 800;
  box-shadow: var(--shadow); display: none; align-items: center; justify-content: center; cursor: pointer;
}
.card.editing .section-plus { display: inline-flex; }

.card-delete-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  background: transparent;
  color: var(--danger);
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  z-index: 20;
  transition: opacity 0.2s, transform 0.2s;
}
.card.editing .card-delete-btn {
  display: flex;
}
.card-delete-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* Card collapse chevron button */
.card-collapse-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
  padding: 0;
}
.card-collapse-btn:hover {
  opacity: 0.6;
}
.card-collapse-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}
/* Rotate chevron when card is collapsed */
.card.collapsed .card-collapse-btn svg {
  transform: rotate(180deg);
}
/* Hide collapse button in edit mode */
.card.editing .card-collapse-btn {
  display: none;
}
/* Reposition collapse button when card is collapsed */
.card.collapsed .card-collapse-btn {
  position: absolute;
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
  right: 16px;
}
/* Card reorder buttons */
.card-reorder-buttons {
  position: absolute;
  top: 16px;
  right: 52px; /* 16px (margin) + 28px (delete btn width) + 8px (gap) */
  display: none;
  flex-direction: row;
  gap: 4px;
  z-index: 10;
}
.card.editing .card-reorder-buttons {
  display: flex;
}

.card-reorder-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: all 0.2s ease;
}
.card-reorder-btn:hover:not(:disabled) {
  background: transparent;
  color: var(--brand);
  border: none;
  transform: scale(1.1);
  box-shadow: none;
}
.card-reorder-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.card-reorder-btn svg {
  width: 14px;
  height: 14px;
}

/* Dark mode adjustments */
[data-theme="dark"] .card-reorder-btn {
  background: transparent;
  color: #9ca3af;
  border: none;
}
[data-theme="dark"] .card-reorder-btn:hover:not(:disabled) {
  background: transparent;
  color: var(--brand);
  border: none;
}

/* Swap buttons for two-column paired cards - minimalist style */
.card-swap-btn {
  position: absolute;
  bottom: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: all 0.2s ease;
  z-index: 10;
}

.card-swap-btn.swap-right {
  right: 16px;
}

.card-swap-btn.swap-left {
  left: 16px;
}

.card.editing .card-swap-btn {
  display: flex;
}

.card-swap-btn:hover {
  background: transparent;
  color: var(--brand);
  transform: scale(1.1);
  box-shadow: none;
}

.card-swap-btn svg {
  width: 14px;
  height: 14px;
}

/* Dark mode adjustments for swap buttons */
[data-theme="dark"] .card-swap-btn {
  background: transparent;
  color: #9ca3af;
}

[data-theme="dark"] .card-swap-btn:hover {
  background: transparent;
  color: var(--brand);
}

/* Two-column container drag styles */
.two-col.dragging {
  opacity: 0.4;
  cursor: move !important;
  transform: scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.two-col[draggable="true"] {
  cursor: move;
}

/* Drag and drop styles */
.card.dragging {
  opacity: 0.4;
  cursor: move !important;
  transform: scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Cross-card item drop target highlight */
.card.drop-target {
  outline: 3px solid var(--brand);
  outline-offset: -3px;
  box-shadow: 0 0 20px rgba(44, 123, 229, 0.4);
  transition: outline 0.15s ease, box-shadow 0.15s ease;
}

[data-theme="dark"] .card.drop-target {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* Subtitle-level drop target highlight for cross-card moves */
.unified-content-group.subtitle-drop-target {
  background: rgba(44, 123, 229, 0.08);
  border-radius: 8px;
  outline: 2px dashed var(--brand);
  outline-offset: 4px;
  transition: background 0.15s ease, outline 0.15s ease;
}

.unified-subtitle-wrapper.subtitle-drop-target {
  background: rgba(44, 123, 229, 0.12);
  border-radius: 6px;
  margin: -4px;
  padding: 4px;
}

[data-theme="dark"] .unified-content-group.subtitle-drop-target {
  background: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .unified-subtitle-wrapper.subtitle-drop-target {
  background: rgba(59, 130, 246, 0.2);
}

.drop-indicator {
  position: absolute !important;
  pointer-events: none;
  z-index: 1000;
  display: none;
}

.drop-indicator.horizontal {
  height: 4px;
}

.drop-indicator.horizontal .drop-line {
  width: 100%;
  height: 4px;
  background: var(--brand);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(44, 123, 229, 0.4);
  animation: pulse-horizontal 1s ease-in-out infinite;
}

.drop-indicator.vertical {
  width: 4px;
}

.drop-indicator.vertical .drop-line {
  width: 4px;
  height: 100%;
  background: var(--brand);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(44, 123, 229, 0.4);
  animation: pulse-vertical 1s ease-in-out infinite;
}

@keyframes pulse-horizontal {
  0%, 100% {
    transform: scaleX(0.95);
    opacity: 0.7;
  }
  50% {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes pulse-vertical {
  0%, 100% {
    transform: scaleY(0.95);
    opacity: 0.7;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* Draggable card cursor in edit mode */
.card.editing[draggable="true"] {
  cursor: move;
}

/* Dark mode adjustments for drop indicator */
[data-theme="dark"] .drop-indicator .drop-line {
  background: var(--brand);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

/* Item-level drag and drop styles */
.item-dragging {
  opacity: 0.5 !important;
  cursor: grabbing !important;
  transform: scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.item-drop-indicator {
  position: absolute !important;
  pointer-events: none;
  z-index: 1001;
  display: none;
}

.item-drop-indicator.horizontal .item-drop-line {
  width: 100%;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(78, 173, 107, 0.5);
  animation: pulse-item-horizontal 0.8s ease-in-out infinite;
}

.item-drop-indicator.vertical .item-drop-line {
  width: 3px;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(78, 173, 107, 0.5);
  animation: pulse-item-vertical 0.8s ease-in-out infinite;
}

@keyframes pulse-item-horizontal {
  0%, 100% {
    opacity: 0.7;
    transform: scaleX(0.95);
  }
  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes pulse-item-vertical {
  0%, 100% {
    opacity: 0.7;
    transform: scaleY(0.95);
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

/* Draggable items cursor in edit mode */
.icon-button[draggable="true"],
.list-item[draggable="true"],
.reminder-item[draggable="true"] {
  cursor: grab !important;
}

.icon-button[draggable="true"]:active,
.list-item[draggable="true"]:active,
.reminder-item[draggable="true"]:active {
  cursor: grabbing !important;
}

/* Dark mode adjustments for item drop indicator */
[data-theme="dark"] .item-drop-indicator.horizontal .item-drop-line,
[data-theme="dark"] .item-drop-indicator.vertical .item-drop-line {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

/* Drop light (js/features/drop-light.js): where a dragged item / a new
   separator will land. Fixed to the viewport and above the Card Edit Modal
   (2000) so it shows while reordering inside it; below item popovers (2500).
   Position and size come from a paused Web Animation; the glass look is in
   glass-fx.css 11b. */
.drop-light {
  position: fixed;
  left: 0;
  top: 0;
  width: 3px;
  height: 3px;
  z-index: 2450;
  pointer-events: none;
  border-radius: 3px;
  background: var(--brand);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}
.drop-light[hidden] { display: none; }
.drop-light.in-task-editor { z-index: 10015; }
.drop-light-beam {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
}

/* Ensure icon-grid spacing remains consistent for all cards, including new ones */
.icon-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 16px !important;
}

/* Override any other icon-grid rules that might be affecting spacing */
section .icon-grid,
.card .icon-grid,
section.card .icon-grid {
  gap: 16px !important;
}

/* Ensure new cards get the correct initial sizing */
section.card[id^="new-card-"] {
  min-height: 120px !important;
  padding: 20px 40px 30px 40px !important;
  position: relative !important;
}

/* Force new cards to start small */
section.card[id^="new-card-"]:not(.card-size-medium):not(.card-size-large):not(.card-size-full) {
  min-height: 120px !important;
  padding: 20px 40px 30px 40px !important;
  position: relative !important;
}

/* Dynamic card sizing for regular cards (not analytics/tools type) */
.card.card-size-small {
  min-height: 120px !important;
  padding: 20px 40px 30px 40px !important;
  position: relative !important;
}

.card.card-size-medium {
  min-height: 160px !important;
  padding: 24px 40px 36px 40px !important;
  position: relative !important;
}

.card.card-size-large {
  min-height: 200px !important;
  padding: 12px 40px 32px 40px !important;
  position: relative !important;
}

.card.card-size-full {
  min-height: 240px !important;
  padding: 12px 40px 32px 40px !important;
  position: relative !important;
}

/* Additional specificity for new cards */
section.card[id^="new-card-"].card-size-small {
  min-height: 120px !important;
  padding: 20px 40px 30px 40px !important;
  position: relative !important;
}

section.card[id^="new-card-"].card-size-medium {
  min-height: 160px !important;
  padding: 24px 40px 36px 40px !important;
  position: relative !important;
}

section.card[id^="new-card-"].card-size-large {
  min-height: 200px !important;
  padding: 12px 40px 32px 40px !important;
  position: relative !important;
}

section.card[id^="new-card-"].card-size-full {
  min-height: 240px !important;
  padding: 12px 40px 32px 40px !important;
  position: relative !important;
}

/* Ensure analytics, tools, and copy-paste cards maintain their original size */
.card[id*="analytics"],
.card[id*="tools"],
.card[id*="newCardAnalytics"],
.card[id*="copy-paste"] {
  min-height: auto;
  padding: 28px 40px 42px 40px;
}

/* Inline add tiles in edit mode (for icons only) - Circular with blue accent */
.icon-add-tile {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #6366f1;
  font-size: 24px;
  font-weight: 400;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 2px 8px rgba(99,102,241,0.1);
}
.icon-row .icon-add-tile { margin-left: 0; }
.icon-grid .icon-add-tile { width: 48px; height: 48px; }
.icon-add-tile:hover {
  transform: scale(1.05);
  background: #e0e7ff;
  box-shadow: 0 4px 12px rgba(99,102,241,0.15);
  color: #4f46e5;
}

/* Reminder add tile styling */
.reminder-item.add-tile {
  width: auto !important;
  height: auto !important;
  padding: 12px 16px 12px 29px !important;
  border-radius: 999px !important;
  background: #eef2ff !important;
  border: 1.4px solid #c7d2fe !important;
  color: #3730a3 !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.reminder-item.add-tile:hover {
  background: #e0e7ff !important;
}

/* Reminder subtitle styling */
.reminder-subtitle {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 24px 0;
  padding: 0 16px;
  cursor: pointer;
  background: transparent;
  width: 100%;
  display: block;
  grid-column: 1 / -1;
}

.reminder-subtitle.editable:hover {
  background: transparent;
  padding: 0 16px;
  margin: 24px 0 24px 0;
}

/* Reminder subtitle wrapper - contains subtitle text and color picker */
.reminder-subtitle-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
  margin: 24px 0 24px 0;
  padding: 0 16px;
}

.reminder-subtitle-wrapper .reminder-subtitle {
  margin: 0;
  padding: 0;
  flex-grow: 0;
  width: auto;
}

.reminder-subtitle-wrapper .reminder-subtitle.editable:hover {
  margin: 0;
  padding: 0;
}

/* Subtitle color picker button */
.subtitle-color-picker-btn {
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  padding: 2px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.subtitle-color-picker-btn:hover {
  transform: scale(1.15);
  background: rgba(0, 0, 0, 0.05);
}

.subtitle-color-picker-btn svg {
  display: block;
}

/* Reminder subtitle add tile styling */
.reminder-subtitle.add-tile {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #3730a3 !important;
  background: #eef2ff !important;
  border: 1.4px solid #c7d2fe !important;
  border-radius: 999px !important;
  padding: 12px 16px !important;
  margin: 24px 0 12px 0 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  grid-column: 1 / -1 !important;
}

.reminder-subtitle.add-tile:hover {
  background: #e0e7ff !important;
}

/* Link reset within list items */
.list-item a {
  color: inherit;
  text-decoration: none;
  display: block;
}

/* File icons in list items */
.list-item a span {
  font-size: 16px;
  vertical-align: middle;
}

/* List item content layout for edit mode */
.list-item-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* List item links button in edit mode */
.list-item-links-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.list-item-links-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--brand);
}

.list-item-links-btn svg {
  width: 14px;
  height: 14px;
}

[data-theme="dark"] .list-item-links-btn {
  color: #94a3b8;
}
[data-theme="dark"] .list-item-links-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #60a5fa;
}

/* List item left container (for view mode with links toggle) */
.list-item-left-container {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.list-item-left-container > a {
  margin-right: 4px;
}

/* List item links toggle button in view mode */
.list-item-links-toggle {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.list-item-links-toggle:hover {
  transform: scale(1.1);
}

.list-item-links-toggle svg {
  width: 12px;
  height: 12px;
}

/* Utility */
.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; }

/* Dark mode specific overrides */
[data-theme="dark"] .reminder-item {
  background: #334155; border-color: rgba(148,163,184,0.1);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.25),
    0 8px 30px rgba(0,0,0,0.15),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}
[data-theme="dark"] .reminder-item::before {
  background:
    radial-gradient(
      ellipse 25% 70% at 12% 30%,
      rgba(255,255,255,0.2) 0%,
      rgba(255,255,255,0.07) 40%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 90% 50% at 50% -10%,
      rgba(255,255,255,0.25) 0%,
      rgba(255,255,255,0.1) 35%,
      rgba(255,255,255,0.02) 60%,
      transparent 80%
    ),
    linear-gradient(
      160deg,
      rgba(255,255,255,0.15) 0%,
      rgba(255,255,255,0.05) 25%,
      transparent 50%,
      rgba(0,0,0,0.04) 75%,
      rgba(255,255,255,0.04) 100%
    );
}
[data-theme="dark"] .reminder-item::after {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.1),
    inset 0 2px 4px rgba(255,255,255,0.15),
    inset 0 -2px 4px rgba(0,0,0,0.18),
    inset 2px 0 4px rgba(255,255,255,0.04),
    inset -2px 0 4px rgba(255,255,255,0.04);
}
[data-theme="dark"] .reminder-item:hover:not(.add-tile) {
  box-shadow:
    0 6px 20px rgba(0,0,0,0.3),
    0 10px 35px rgba(0,0,0,0.2),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}
[data-theme="dark"] .subtitle-color-picker-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .icon-button {
  background: #334155; border-color: rgba(148,163,184,0.1);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.25),
    0 8px 30px rgba(0,0,0,0.15),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12),
    inset 3px 0 8px rgba(0,0,0,0.05),
    inset -3px 0 8px rgba(0,0,0,0.05);
}
[data-theme="dark"] .icon-button::before {
  background:
    /* Specular hot-spot */
    radial-gradient(
      ellipse 40% 30% at 28% 18%,
      rgba(255,255,255,0.3) 0%,
      rgba(255,255,255,0.1) 40%,
      transparent 75%
    ),
    /* Reflection arc */
    radial-gradient(
      ellipse 80% 45% at 50% -8%,
      rgba(255,255,255,0.28) 0%,
      rgba(255,255,255,0.12) 35%,
      rgba(255,255,255,0.03) 60%,
      transparent 75%
    ),
    /* Diagonal shine sweep */
    linear-gradient(
      140deg,
      rgba(255,255,255,0.18) 0%,
      rgba(255,255,255,0.06) 30%,
      transparent 50%,
      rgba(0,0,0,0.04) 70%,
      rgba(255,255,255,0.05) 100%
    );
}
[data-theme="dark"] .icon-button::after {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.12),
    inset 0 2px 4px rgba(255,255,255,0.18),
    inset 0 -2px 4px rgba(0,0,0,0.2),
    inset 2px 0 4px rgba(255,255,255,0.05),
    inset -2px 0 4px rgba(255,255,255,0.05);
  border: none;
}
[data-theme="dark"] .icon-button:hover {
  box-shadow:
    0 6px 20px rgba(0,0,0,0.3),
    0 10px 35px rgba(0,0,0,0.2),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12),
    inset 3px 0 8px rgba(0,0,0,0.05),
    inset -3px 0 8px rgba(0,0,0,0.05);
}
[data-theme="dark"] .list-item {
  background: #334155; border-color: rgba(148,163,184,0.1);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.25),
    0 8px 30px rgba(0,0,0,0.15),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}
[data-theme="dark"] .list-item::before {
  background:
    radial-gradient(
      ellipse 25% 70% at 12% 30%,
      rgba(255,255,255,0.2) 0%,
      rgba(255,255,255,0.07) 40%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 90% 50% at 50% -10%,
      rgba(255,255,255,0.25) 0%,
      rgba(255,255,255,0.1) 35%,
      rgba(255,255,255,0.02) 60%,
      transparent 80%
    ),
    linear-gradient(
      160deg,
      rgba(255,255,255,0.15) 0%,
      rgba(255,255,255,0.05) 25%,
      transparent 50%,
      rgba(0,0,0,0.04) 75%,
      rgba(255,255,255,0.04) 100%
    );
}
[data-theme="dark"] .list-item::after {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.1),
    inset 0 2px 4px rgba(255,255,255,0.15),
    inset 0 -2px 4px rgba(0,0,0,0.18),
    inset 2px 0 4px rgba(255,255,255,0.04),
    inset -2px 0 4px rgba(255,255,255,0.04);
}
[data-theme="dark"] .list-item:hover:not(.add-tile) {
  box-shadow:
    0 6px 20px rgba(0,0,0,0.3),
    0 10px 35px rgba(0,0,0,0.2),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}
[data-theme="dark"] .list-item.tools {
  background: #1e3a3a; border-color: #2d5555;
}
[data-theme="dark"] .icon-separator {
  filter: brightness(0.7);
}
[data-theme="dark"] input,
[data-theme="dark"] select {
  background: #334155; color: var(--text); border-color: #475569;
}
[data-theme="dark"] .calendar-section select {
  background: #334155;
}
[data-theme="dark"] .media-item {
  background: #334155;
}
[data-theme="dark"] .media-item img {
  background: #475569;
}

/* Media library modal */
.media-library { position: fixed; inset: 0; display: none; z-index: 4000; }
.media-library[hidden] { display: none; }
.media-library:not([hidden]) { display: block; }
.media-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.35); }
.media-dialog { position: absolute; top: 20px; left: 10%; right: 10%; bottom: 10%; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); display: grid; grid-template-rows: auto 1fr auto; }
.media-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #e5e7eb; }
.media-body { overflow: auto; padding: 12px 16px; }
.media-footer { padding: 12px 16px; border-top: 1px solid #e5e7eb; display: flex; justify-content: flex-end; }
.media-actions { display: flex; gap: 8px; align-items: center; }
.media-grid { display: flex; flex-direction: column; gap: 12px; }
.media-section-header { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); padding: 4px 0; border-bottom: 1px solid rgba(0,0,0,0.06); }
[data-theme="dark"] .media-section-header { border-bottom-color: rgba(255,255,255,0.06); }
.media-section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.media-item { border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: #f8fafc; cursor: pointer; display: grid; grid-template-rows: 1fr auto; }
.media-item.selected { border-color: var(--brand); }
.media-item img { width: 100%; height: 120px; object-fit: contain; background: white; }
.media-item .name { padding: 6px 8px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-btn { display: inline-grid; align-items: center; border: 1px dashed #cbd5e1; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.upload-btn[aria-busy="true"] { cursor: progress; opacity: 0.7; }
/* Delete button states */
/* Delete button: grey background when disabled/default item, red when user item */
#media-delete { background: #9ca3af; border-color: #9ca3af; color: #f1f5f9; transition: background 0.15s, border-color 0.15s; }
#media-delete.media-delete-active { background: var(--danger); border-color: var(--danger); color: white; }
#media-delete:disabled { background: #9ca3af; border-color: #9ca3af; color: #f1f5f9; opacity: 0.6; }

/* Breakdown modal */
.breakdown-modal { position: fixed; inset: 0; display: none; z-index: 2000; }
.breakdown-modal[hidden] { display: none; }
.breakdown-modal:not([hidden]) { display: block; }
.breakdown-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.3); }
.breakdown-dialog {
  position: fixed;
  right: 20px;
  bottom: 84px;
  width: 400px;
  max-height: 600px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid #e5e7eb;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.breakdown-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #e5e7eb;
}
.breakdown-header h4 { margin: 0; font-size: 18px; font-weight: 600; }
.breakdown-body { padding: 20px; overflow-y: auto; }
.breakdown-current-section { margin-bottom: 24px; }
.breakdown-label { display: block; font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 8px; }
.breakdown-current-row { display: flex; gap: 12px; align-items: center; }
.breakdown-current-row input[type="number"] {
  flex: 1; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 14px;
  background: var(--card); color: var(--text);
}
.breakdown-current-row input[type="number"]:disabled {
  background: #f3f4f6; cursor: not-allowed;
}
.breakdown-lock-label {
  display: flex; align-items: center; cursor: pointer; user-select: none;
  background: #f3f4f6; padding: 8px 12px; border-radius: 8px;
  transition: all 0.2s ease;
}
.breakdown-lock-label:hover { background: #e5e7eb; }
.breakdown-lock-label input[type="checkbox"] { display: none; }
.breakdown-lock-label .lock-icon,
.breakdown-lock-label .unlock-icon {
  font-size: 18px;
  font-weight: bold;
  color: var(--text);
}
.breakdown-lock-label input[type="checkbox"]:checked ~ .lock-icon { display: inline; }
.breakdown-lock-label input[type="checkbox"]:checked ~ .unlock-icon { display: none; }
.breakdown-lock-label input[type="checkbox"]:not(:checked) ~ .lock-icon { display: none; }
.breakdown-lock-label input[type="checkbox"]:not(:checked) ~ .unlock-icon { display: inline; }
.breakdown-summary-section h5 { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--text); }
.breakdown-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.breakdown-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
}
.breakdown-row input {
  padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 14px;
  background: var(--card); color: var(--text);
}
.breakdown-row input[type="text"] { grid-column: 1; }
.breakdown-row input[type="number"] { width: 100px; }
.breakdown-row .btn-delete-row {
  width: 32px; height: 32px; border-radius: 6px; border: none;
  background: #fee2e2; color: #7f1d1d; cursor: pointer; font-size: 16px;
  display: grid; place-items: center;
}
.breakdown-row .btn-delete-row:hover { background: #fecaca; }
.btn-add-row {
  width: 100%; padding: 8px 12px; border: 1px dashed #cbd5e1; border-radius: 6px;
  background: transparent; color: var(--brand); cursor: pointer; font-size: 14px; font-weight: 500;
}
.btn-add-row:hover { background: #f0f9ff; border-color: var(--brand); }
.breakdown-footer {
  display: flex; gap: 12px; justify-content: flex-end;
  padding: 16px 20px; border-top: 1px solid #e5e7eb;
}
.breakdown-footer .btn { padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; font-size: 14px; }
.breakdown-footer .btn.secondary { background: #e5e7eb; color: #374151; }
.breakdown-footer .btn.secondary:hover { background: #d1d5db; }
.breakdown-footer .btn.primary { background: var(--brand); color: white; }
.breakdown-footer .btn.primary:hover { background: #1d4ed8; }

/* Dark mode overrides for breakdown */
[data-theme="dark"] .breakdown-dialog {
  background: var(--card);
}
[data-theme="dark"] .breakdown-current-row input[type="number"],
[data-theme="dark"] .breakdown-row input {
  background: #334155; border-color: #475569;
}
[data-theme="dark"] .breakdown-current-row input[type="number"]:disabled {
  background: #1e293b;
}
[data-theme="dark"] .btn-breakdown {
  background: #1e3a5f;
  color: #60a5fa;
}
[data-theme="dark"] .btn-breakdown:hover {
  background: #2d4a70;
}

/* Appearance Modal */
.appearance-modal { position: fixed; inset: 0; display: none; z-index: 2000; }
.appearance-modal[hidden] { display: none; }
.appearance-modal:not([hidden]) { display: flex; align-items: center; justify-content: center; }
.appearance-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.appearance-dialog {
  position: relative;
  width: 340px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  border: 1px solid #e5e7eb;
  z-index: 1;
}
.appearance-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #e5e7eb;
}
.appearance-header h4 { margin: 0; font-size: 18px; font-weight: 600; }
.appearance-close-btn {
  background: none; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; padding: 0;
  color: var(--muted); transition: color 0.15s;
}
.appearance-close-btn:hover { color: var(--text); }
.appearance-body { padding: 20px; }
.appearance-section { margin-bottom: 20px; }
.appearance-section:last-child { margin-bottom: 0; }
.appearance-label { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.appearance-toggle-row { display: flex; gap: 10px; }
.appearance-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: #f8fafc;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
}
.appearance-option:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.appearance-option.active {
  background: #eef2ff;
  border-color: var(--brand);
  color: var(--brand);
}
.appearance-option svg {
  width: 28px;
  height: 28px;
}
.appearance-select {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}
.appearance-select:hover {
  border-color: #cbd5e1;
}
.appearance-select:focus {
  outline: none;
  border-color: var(--brand);
}
[data-theme="dark"] .appearance-select {
  background: #334155 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
  border-color: #475569;
}
[data-theme="dark"] .appearance-select:hover {
  border-color: #64748b;
}

/* Toggle Switch for Appearance Modal */
.appearance-toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}
.appearance-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.appearance-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  border-radius: 26px;
  transition: 0.3s;
}
.appearance-toggle-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.appearance-toggle-switch input:checked + .appearance-toggle-slider {
  background-color: var(--brand);
}
.appearance-toggle-switch input:checked + .appearance-toggle-slider::before {
  transform: translateX(22px);
}
[data-theme="dark"] .appearance-toggle-slider {
  background-color: #475569;
}
[data-theme="dark"] .appearance-toggle-slider::before {
  background-color: #e2e8f0;
}

.appearance-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
}
.appearance-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}
.appearance-btn.secondary {
  background: #f1f5f9;
  color: var(--text);
}
.appearance-btn.secondary:hover {
  background: #e2e8f0;
}
.appearance-btn.primary {
  background: var(--brand);
  color: white;
}
.appearance-btn.primary:hover {
  background: #2563eb;
}
[data-theme="dark"] .appearance-dialog { border-color: #475569; }
[data-theme="dark"] .appearance-header { border-color: #475569; }
[data-theme="dark"] .appearance-actions { border-color: #475569; }
[data-theme="dark"] .appearance-option { background: #334155; border-color: #475569; color: #f1f5f9; }
[data-theme="dark"] .appearance-option:hover { background: #3d4f65; border-color: #64748b; }
[data-theme="dark"] .appearance-option.active { background: #1e3a5f; border-color: var(--brand); }
[data-theme="dark"] .appearance-btn.secondary { background: #334155; color: var(--text); }
[data-theme="dark"] .appearance-btn.secondary:hover { background: #475569; }

/* Appearance modal - divider & backup */
.appearance-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 4px 0;
}
[data-theme="dark"] .appearance-divider {
  background: #475569;
}
.appearance-backup-row {
  display: flex;
  gap: 10px;
}
.appearance-backup-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  color: var(--text);
  transition: all 0.15s ease;
}
.appearance-backup-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}
[data-theme="dark"] .appearance-backup-btn {
  background: #334155;
  border-color: #475569;
}
[data-theme="dark"] .appearance-backup-btn:hover {
  background: #475569;
  border-color: #64748b;
}
/* Add back from a backup (only what the dashboard lacks), under Download / Upload */
.appearance-addback-btn {
  justify-content: center;
  margin-top: 10px;
}
.appearance-addback-note {
  margin: 8px 2px 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

/* Task Settings modal (Settings → Tasks). Reuses the appearance modal
   classes; sits above Settings, like the File Manager. */
.task-settings-modal { z-index: 2100; }
.task-settings-dialog {
  width: 820px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
}
.task-settings-dialog .appearance-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  container-type: inline-size;
}
/* Two columns side by side (templates left, categories right); one column,
   categories first, when the dialog is narrow (phones, the mobile preview) */
.task-settings-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  grid-template-areas: "tpl cats";
}
.task-settings-col { margin: 0; min-width: 0; }
.task-settings-col-tpl { grid-area: tpl; padding-right: 24px; }
.task-settings-col-cats {
  grid-area: cats;
  padding-left: 24px;
  border-left: 1px solid var(--glass-divider, #e5e7eb);
}
@container (max-width: 600px) {
  .task-settings-columns {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "cats" "tpl";
  }
  .task-settings-col-tpl {
    padding: 20px 0 0;
    margin-top: 20px;
    border-top: 1px solid var(--glass-divider, #e5e7eb);
  }
  .task-settings-col-cats { padding-left: 0; border-left: 0; }
}
.task-settings-cat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.task-settings-cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.task-settings-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.task-settings-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--glass-divider, #e5e7eb);
  border-radius: 8px;
  background: var(--glass-field, #fff);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.task-settings-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.task-settings-input:disabled { opacity: 0.55; }
.task-settings-delete-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.task-settings-delete-btn:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}
.task-settings-add-row {
  display: flex;
  gap: 8px;
  padding-left: 24px;
}
.task-settings-add-btn { flex-shrink: 0; }
.task-settings-add-btn:disabled { opacity: 0.5; cursor: default; }
.task-settings-hint {
  margin: 10px 0 0 24px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
.task-settings-empty {
  font-size: 13px;
  color: var(--muted);
}
[data-theme="dark"] .task-settings-input { border-color: #475569; }

/* Subtask templates: one row per template; the open one shows its editor */
.task-settings-tpl-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.task-settings-tpl-hint { margin-left: 0; }
.task-settings-tpl {
  border: 1px solid transparent;
  border-radius: 10px;
  transition: border-color 0.15s, background-color 0.15s;
}
.task-settings-tpl.is-open {
  border-color: var(--glass-divider, #e5e7eb);
  background: color-mix(in srgb, var(--brand) 4%, transparent);
}
.task-settings-tpl-head {
  display: flex;
  align-items: center;
  gap: 4px;
}
.task-settings-tpl-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.task-settings-tpl-toggle:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.task-settings-tpl-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.task-settings-tpl-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.task-settings-tpl.is-open .task-settings-tpl-chevron { transform: rotate(90deg); }
.task-settings-tpl-name {
  min-width: 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-settings-tpl-name.is-untitled { color: var(--muted); font-style: italic; }
.task-settings-tpl-count {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
.task-settings-tpl-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 10px 12px 28px;
}
.task-settings-tpl-body[hidden] { display: none; }
.task-settings-tpl-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.task-settings-tpl-items:empty { display: none; }
.task-settings-tpl-item {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: -18px;
}
.task-settings-tpl-item .task-settings-input { padding: 6px 10px; font-size: 13px; }
.task-settings-tpl-items.is-sorting { user-select: none; cursor: grabbing; }
.task-settings-tpl-item.is-dragging { opacity: 0.6; }
.task-settings-tpl-grip {
  width: 14px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  opacity: 0.6;
  cursor: grab;
  touch-action: none;
}
.task-settings-tpl-grip:hover { opacity: 1; }
.task-settings-tpl-item.is-dragging .task-settings-tpl-grip { cursor: grabbing; opacity: 1; }
.task-settings-tpl-item-remove {
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.task-settings-tpl-item-remove:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}
.task-settings-tpl-add {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.task-settings-tpl-add:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
[data-theme="dark"] .task-settings-tpl.is-open { border-color: #475569; }

/* Copy-paste card styles */
.copy-paste-list {
  display: block;
  padding: 8px;
}


.copy-paste-subtitle-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin-bottom: 16px;
}

.copy-paste-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 12px 16px 12px 29px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 48px;
  max-height: 48px;
  height: 48px;
  position: relative;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.06),
    0 8px 30px rgba(0,0,0,0.04),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}
.copy-paste-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(
      ellipse 25% 70% at 12% 30%,
      rgba(255,255,255,0.55) 0%,
      rgba(255,255,255,0.18) 40%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 90% 50% at 50% -10%,
      rgba(255,255,255,0.65) 0%,
      rgba(255,255,255,0.3) 35%,
      rgba(255,255,255,0.06) 60%,
      transparent 80%
    ),
    linear-gradient(
      160deg,
      rgba(255,255,255,0.45) 0%,
      rgba(255,255,255,0.15) 25%,
      transparent 50%,
      rgba(255,255,255,0.02) 75%,
      rgba(255,255,255,0.08) 100%
    );
  pointer-events: none;
  z-index: 1;
}
.copy-paste-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.4),
    inset 0 2px 4px rgba(255,255,255,0.55),
    inset 0 -2px 4px rgba(0,0,0,0.04),
    inset 2px 0 4px rgba(255,255,255,0.1),
    inset -2px 0 4px rgba(255,255,255,0.1);
  pointer-events: none;
  z-index: 2;
}

.copy-paste-item:hover:not(.add-tile) {
  background: #f1f5f9;
  border-color: rgba(255,255,255,0.45);
  transform: scale(1.03);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.08),
    0 10px 35px rgba(0,0,0,0.05),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}

.copy-paste-item.add-tile {
  padding: 12px 16px !important;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef2ff;
  border: 0.7px solid #c7d2fe;
  cursor: pointer;
  min-height: 48px;
  max-height: 48px;
  height: 48px;
}

.copy-paste-item.add-tile:hover {
  background: #e0e7ff;
  border-color: #a5b4fc;
}

.copy-paste-text {
  flex: 1;
  color: var(--text);
}

.copy-paste-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  color: var(--muted);
}

.copy-paste-icon:hover {
  background: #e5e7eb;
  color: var(--brand);
}

.copy-paste-icon svg {
  display: block;
}

/* Copy-text modal */
.copy-text-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 2000;
}

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

.copy-text-modal:not([hidden]) {
  display: block;
}

.copy-text-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
}

.copy-text-dialog {
  position: fixed;
  right: 20px;
  bottom: 84px;
  width: 400px;
  max-height: 500px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid #e5e7eb;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.copy-text-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.copy-text-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.copy-text-body {
  padding: 20px;
  overflow-y: auto;
}

.copy-text-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.copy-text-label textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--card);
  color: var(--text);
  resize: vertical;
  margin-top: 8px;
}

.copy-text-label textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}

.copy-text-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
}

.copy-text-footer .btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

.copy-text-footer .btn.secondary {
  background: #e5e7eb;
  color: #374151;
}

.copy-text-footer .btn.secondary:hover {
  background: #d1d5db;
}

.copy-text-footer .btn.primary {
  background: var(--brand);
  color: white;
}

.copy-text-footer .btn.primary:hover {
  background: #1d4ed8;
}

/* Dark mode overrides for copy-paste */
[data-theme="dark"] .copy-paste-item {
  background: #334155;
  border-color: rgba(148,163,184,0.1);
  color: var(--text);
  min-height: 48px;
  max-height: 48px;
  height: 48px;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.25),
    0 8px 30px rgba(0,0,0,0.15),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}
[data-theme="dark"] .copy-paste-item::before {
  background:
    radial-gradient(
      ellipse 25% 70% at 12% 30%,
      rgba(255,255,255,0.2) 0%,
      rgba(255,255,255,0.07) 40%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 90% 50% at 50% -10%,
      rgba(255,255,255,0.25) 0%,
      rgba(255,255,255,0.1) 35%,
      rgba(255,255,255,0.02) 60%,
      transparent 80%
    ),
    linear-gradient(
      160deg,
      rgba(255,255,255,0.15) 0%,
      rgba(255,255,255,0.05) 25%,
      transparent 50%,
      rgba(0,0,0,0.04) 75%,
      rgba(255,255,255,0.04) 100%
    );
}
[data-theme="dark"] .copy-paste-item::after {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.1),
    inset 0 2px 4px rgba(255,255,255,0.15),
    inset 0 -2px 4px rgba(0,0,0,0.18),
    inset 2px 0 4px rgba(255,255,255,0.04),
    inset -2px 0 4px rgba(255,255,255,0.04);
}

[data-theme="dark"] .copy-paste-item:hover:not(.add-tile) {
  background: #475569;
  border-color: rgba(148,163,184,0.15);
  transform: scale(1.03);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.3),
    0 10px 35px rgba(0,0,0,0.2),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}

[data-theme="dark"] .copy-paste-item.add-tile {
  background: #374151;
  border-color: #4b5563;
  color: #cbd5e1;
  min-height: 48px;
  max-height: 48px;
  height: 48px;
}

[data-theme="dark"] .copy-paste-item.add-tile:hover {
  background: #4b5563;
  border-color: #6b7280;
}

[data-theme="dark"] .copy-paste-icon:hover {
  background: #475569;
  color: var(--brand);
}

[data-theme="dark"] .copy-text-dialog {
  background: var(--card);
  border-color: #475569;
}

[data-theme="dark"] .copy-text-label textarea {
  background: #334155;
  border-color: #475569;
  color: var(--text);
}

[data-theme="dark"] .copy-text-label textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
[data-theme="dark"] .breakdown-lock-label {
  background: #334155;
}
[data-theme="dark"] .breakdown-lock-label:hover {
  background: #475569;
}
[data-theme="dark"] .edit-popover input.disabled-sum-mode {
  background: #1e293b !important;
  color: #94a3b8;
}
[data-theme="dark"] .btn-accept {
  background: #064e3b;
  color: #a7f3d0;
}
[data-theme="dark"] .btn-cancel {
  background: #7f1d1d;
  color: #fecaca;
}
[data-theme="dark"] .btn-accept,
[data-theme="dark"] .btn-cancel {
  box-shadow:
    0 4px 16px rgba(0,0,0,0.3),
    inset 0 0 0 1.5px rgba(255,255,255,0.1),
    inset 0 2px 6px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.15),
    inset 3px 0 6px rgba(255,255,255,0.04),
    inset -3px 0 6px rgba(255,255,255,0.04);
}
[data-theme="dark"] .btn-delete {
  color: #9ca3af;
}
[data-theme="dark"] .btn-delete:hover {
  color: #f3f4f6;
}
[data-theme="dark"] .breakdown-footer .btn.secondary {
  background: #374151;
  color: #f3f4f6;
}
[data-theme="dark"] .breakdown-footer .btn.secondary:hover {
  background: #4b5563;
}
[data-theme="dark"] .hashtag-btn {
  color: #cbd5e1;
}
[data-theme="dark"] .calendar-btn svg {
  stroke: #cbd5e1;
}
[data-theme="dark"] .fab-left {
  background: #374151;
  color: #f3f4f6;
}
[data-theme="dark"] .fab-left:hover {
  background: #4b5563;
}

/* Dark mode styling for add tiles */
[data-theme="dark"] .add-tile {
  background: #374151 !important;
  border-color: #4b5563 !important;
  color: #cbd5e1 !important;
}
[data-theme="dark"] .add-tile:hover {
  background: #4b5563 !important;
}
[data-theme="dark"] .icon-add-tile {
  background: #312e81;
  border-color: #4338ca;
  color: #a5b4fc;
  box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}
[data-theme="dark"] .icon-add-tile:hover {
  background: #3730a3;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
  color: #c7d2fe;
}
[data-theme="dark"] .reminder-item.add-tile {
  background: #374151 !important;
  border-color: #4b5563 !important;
  color: #cbd5e1 !important;
}
[data-theme="dark"] .reminder-item.add-tile:hover {
  background: #4b5563 !important;
}
[data-theme="dark"] .reminder-subtitle.add-tile {
  background: #374151 !important;
  border-color: #4b5563 !important;
  color: #cbd5e1 !important;
}
[data-theme="dark"] .reminder-subtitle.add-tile:hover {
  background: #4b5563 !important;
}

/* Dark mode styling for edit and calendar popovers */
[data-theme="dark"] .edit-popover,
[data-theme="dark"] .calendar-popover {
  border-color: #475569;
}
[data-theme="dark"] .edit-popover textarea {
  background: var(--card);
  border-color: #475569;
  color: var(--text);
}
[data-theme="dark"] .calendar-section input,
[data-theme="dark"] .calendar-section select {
  border-color: #475569;
}

/* ========================================
   GLASS MODE STYLES (Glassmorphism)
   ======================================== */

/* Glass mode - Body background (Classic theme - grey shades, default) */
body[data-style="glass"],
body[data-style="glass"][data-glass-theme="classic"] {
  background: linear-gradient(145deg, #d5dae2 0%, #c7cdd7 30%, #b5bcc9 60%, #a3acbb 100%);
  background-attachment: fixed;
}

body[data-theme="dark"][data-style="glass"],
body[data-theme="dark"][data-style="glass"][data-glass-theme="classic"] {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  background-attachment: fixed;
}

/* Glass mode - Sunset theme */
body[data-style="glass"][data-glass-theme="sunset"] {
  background: linear-gradient(135deg, #ffeb99 0%, #f9be82 30%, #e4a87a 50%, #cbaed4 75%, #c19fcc 100%);
  background-attachment: fixed;
}

body[data-theme="dark"][data-style="glass"][data-glass-theme="sunset"] {
  background: linear-gradient(135deg, #4a2d1c 0%, #6b4028 30%, #7d4c34 50%, #553a5e 75%, #4a3555 100%);
  background-attachment: fixed;
}

/* Sunset theme - More blur on cards for dreamy effect */
body[data-style="glass"][data-glass-theme="sunset"] .card,
body[data-style="glass"][data-glass-theme="sunset"] .app-header.card {
  background: rgba(255, 255, 255, 0.5) !important;
  backdrop-filter: blur(40px) !important;
  -webkit-backdrop-filter: blur(40px) !important;
}

body[data-theme="dark"][data-style="glass"][data-glass-theme="sunset"] .card,
body[data-theme="dark"][data-style="glass"][data-glass-theme="sunset"] .app-header.card {
  background: rgba(30, 41, 59, 0.5) !important;
  backdrop-filter: blur(40px) !important;
  -webkit-backdrop-filter: blur(40px) !important;
}

/* Glass mode - Light theme cards (neumorphic glass) */
body[data-style="glass"] .card,
body[data-style="glass"] .app-header.card {
  background: rgba(255, 255, 255, 0.6) !important;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  box-shadow:
    6px 6px 20px rgba(0, 0, 0, 0.1),
    -3px -3px 12px rgba(255, 255, 255, 0.65),
    inset 0 1px 1px rgba(255, 255, 255, 0.9),
    inset 1px 0 1px rgba(255, 255, 255, 0.6) !important;
}

/* Prismatic border shimmer (light classic glass only) */
body[data-style="glass"]:not([data-theme="dark"]):not([data-glass-theme="sunset"]) .card::after,
body[data-style="glass"][data-glass-theme="classic"]:not([data-theme="dark"]) .card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.7) 0%,
    rgba(180, 210, 255, 0.25) 25%,
    rgba(255, 190, 180, 0.15) 50%,
    rgba(180, 255, 210, 0.15) 75%,
    rgba(255, 255, 255, 0.5) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}

/* Enhanced glass shine — top-left light catch */
body[data-style="glass"]:not([data-theme="dark"]) .card::before {
  background:
    linear-gradient(
      155deg,
      rgba(255,255,255,0.3) 0%,
      rgba(255,255,255,0.1) 15%,
      transparent 40%,
      rgba(255,255,255,0.02) 75%,
      rgba(255,255,255,0.06) 100%
    ) !important;
}

body[data-style="glass"] .unified-icon-btn,
body[data-style="glass"] .icon-btn,
body[data-style="glass"] .icon-button {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 3px 3px 8px rgba(0,0,0,0.06), -1px -1px 4px rgba(255,255,255,0.5);
}

body[data-style="glass"] .unified-icon-btn:hover,
body[data-style="glass"] .icon-btn:hover,
body[data-style="glass"] .icon-button:hover {
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 3px 3px 10px rgba(0,0,0,0.08), -1px -1px 6px rgba(255,255,255,0.6);
}

body[data-style="glass"] .unified-reminder-item,
body[data-style="glass"] .reminder-item {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 3px 3px 8px rgba(0,0,0,0.05), -1px -1px 4px rgba(255,255,255,0.4);
}

body[data-style="glass"] .unified-reminder-item:hover,
body[data-style="glass"] .reminder-item:hover {
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 3px 3px 10px rgba(0,0,0,0.07), -1px -1px 6px rgba(255,255,255,0.5);
}

body[data-style="glass"] .unified-subtask-item,
body[data-style="glass"] .list-item {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 3px 3px 8px rgba(0,0,0,0.05), -1px -1px 4px rgba(255,255,255,0.4);
}

body[data-style="glass"] .unified-subtask-item:hover,
body[data-style="glass"] .list-item:hover {
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 3px 3px 10px rgba(0,0,0,0.07), -1px -1px 6px rgba(255,255,255,0.5);
}

body[data-style="glass"] .unified-copypaste-item,
body[data-style="glass"] .copy-paste-item {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 3px 3px 8px rgba(0,0,0,0.05), -1px -1px 4px rgba(255,255,255,0.4);
}

body[data-style="glass"] .unified-copypaste-item:hover,
body[data-style="glass"] .copy-paste-item:hover {
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 3px 3px 10px rgba(0,0,0,0.07), -1px -1px 6px rgba(255,255,255,0.5);
}

/* Glass mode - Add tiles */
body[data-style="glass"] .add-tile {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px dashed rgba(255, 255, 255, 0.45);
  box-shadow: 3px 3px 10px rgba(0,0,0,0.04), -2px -2px 8px rgba(255,255,255,0.4);
}

/* Glass mode - Dark theme cards */
body[data-theme="dark"][data-style="glass"] .card,
body[data-theme="dark"][data-style="glass"] .app-header.card {
  background: rgba(30, 41, 59, 0.7) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: none !important;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 0 0 2px rgba(255,255,255,0.09),
    inset 0 6px 20px rgba(255,255,255,0.08),
    inset 0 -6px 20px rgba(0,0,0,0.15),
    inset 6px 0 20px rgba(255,255,255,0.04),
    inset -6px 0 20px rgba(255,255,255,0.04) !important;
}

body[data-theme="dark"][data-style="glass"] .unified-icon-btn,
body[data-theme="dark"][data-style="glass"] .icon-btn,
body[data-theme="dark"][data-style="glass"] .icon-button {
  background: rgba(51, 65, 85, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(71, 85, 105, 0.4);
}

body[data-theme="dark"][data-style="glass"] .unified-icon-btn:hover,
body[data-theme="dark"][data-style="glass"] .icon-btn:hover,
body[data-theme="dark"][data-style="glass"] .icon-button:hover {
  background: rgba(51, 65, 85, 0.75);
}

body[data-theme="dark"][data-style="glass"] .unified-reminder-item,
body[data-theme="dark"][data-style="glass"] .reminder-item {
  background: rgba(51, 65, 85, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
}

body[data-theme="dark"][data-style="glass"] .unified-reminder-item:hover,
body[data-theme="dark"][data-style="glass"] .reminder-item:hover {
  background: rgba(51, 65, 85, 0.75);
}

body[data-theme="dark"][data-style="glass"] .unified-subtask-item,
body[data-theme="dark"][data-style="glass"] .list-item {
  background: rgba(51, 65, 85, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
}

body[data-theme="dark"][data-style="glass"] .unified-subtask-item:hover,
body[data-theme="dark"][data-style="glass"] .list-item:hover {
  background: rgba(51, 65, 85, 0.75);
}

body[data-theme="dark"][data-style="glass"] .unified-copypaste-item,
body[data-theme="dark"][data-style="glass"] .copy-paste-item {
  background: rgba(51, 65, 85, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
}

body[data-theme="dark"][data-style="glass"] .unified-copypaste-item:hover,
body[data-theme="dark"][data-style="glass"] .copy-paste-item:hover {
  background: rgba(51, 65, 85, 0.75);
}

/* Glass mode - Dark add tiles */
body[data-theme="dark"][data-style="glass"] .add-tile {
  background: rgba(55, 65, 81, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px dashed rgba(75, 85, 99, 0.5);
}

/* Glass mode - Search results */
body[data-style="glass"] .search-item {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 3px 3px 8px rgba(0,0,0,0.05), -1px -1px 4px rgba(255,255,255,0.4);
}

body[data-style="glass"] .search-item:hover {
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 3px 3px 10px rgba(0,0,0,0.07), -1px -1px 6px rgba(255,255,255,0.5);
}

body[data-theme="dark"][data-style="glass"] .search-item {
  background: rgba(51, 65, 85, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(71, 85, 105, 0.3);
}

body[data-theme="dark"][data-style="glass"] .search-item:hover {
  background: rgba(51, 65, 85, 0.75);
}



/* Glass mode - Popovers and modals */
body[data-style="glass"] .edit-popover,
body[data-style="glass"] .calendar-popover,
body[data-style="glass"] .interval-popover {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 6px 6px 20px rgba(0,0,0,0.1), -3px -3px 12px rgba(255,255,255,0.5);
}

body[data-theme="dark"][data-style="glass"] .edit-popover,
body[data-theme="dark"][data-style="glass"] .calendar-popover,
body[data-theme="dark"][data-style="glass"] .interval-popover {
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}


/* ========================================
   COLLAPSED CARD STYLES - MUST BE LAST
   These rules MUST come after all other card rules
   to ensure they override size-specific rules
   ======================================== */

/* Collapsed card state - MUST have higher specificity than :not() rules */
section.card[id^="new-card-"]:not(.card-size-medium):not(.card-size-large):not(.card-size-full).collapsed,
section.card[id^="new-card-"].collapsed,
section.card[id^="new-card-"].card-size-small.collapsed,
section.card[id^="new-card-"].card-size-medium.collapsed,
section.card[id^="new-card-"].card-size-large.collapsed,
section.card[id^="new-card-"].card-size-full.collapsed,
section.card.collapsed[id],
section.card.collapsed {
  padding: 20px 40px !important;
  margin-bottom: 16px !important;
  cursor: pointer;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

section.card.collapsed[id] > *:not(h2):not(h3):not(.section-title-wrapper):not(.card-collapse-btn),
section.card.collapsed > *:not(h2):not(h3):not(.section-title-wrapper):not(.card-collapse-btn) {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

section.card.collapsed[id] > h2,
section.card.collapsed[id] > h3,
section.card.collapsed > h2,
section.card.collapsed > h3,
section.card.collapsed .section-title-wrapper,
section.card.collapsed .section-title-wrapper h3 {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
  height: auto !important;
  min-height: 0 !important;
  display: block !important;
  vertical-align: top !important;
  cursor: pointer;
}

/* Hide extra elements inside section-title-wrapper when collapsed */
section.card.collapsed .section-title-wrapper > *:not(h3):not(.section-title) {
  display: none !important;
}

/* Two-column container collapsed state */
.two-col.collapsed {
  margin-bottom: 16px !important;
  min-height: auto !important;
}

.two-col.collapsed .card {
  padding: 20px 40px !important;
  margin: 0 !important;
  min-height: auto !important;
}

/* Hide the analytics-wrapper and section-icon containers in collapsed cards */
.card.collapsed .analytics-wrapper,
section.card.collapsed .analytics-wrapper {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  overflow: hidden !important;
}

.card.collapsed .section-icon,
section.card.collapsed .section-icon {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}


/* Color Picker Button */
.color-picker-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}

.color-picker-btn:hover {
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.05);
}

.color-picker-btn svg {
  display: block;
}

[data-theme="dark"] .color-picker-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Color Picker Modal */
.color-picker-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.color-picker-dialog {
  background: var(--card);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
}

.color-picker-dialog h3 {
  margin: 0 0 24px;
  font-size: 20px;
  color: var(--text);
}

.color-picker-content {
  margin-bottom: 24px;
}

.color-picker-content input[type="color"] {
  width: 100%;
  height: 60px;
  border: 2px solid var(--muted);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 16px;
}

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

.color-preset {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-preset:hover {
  transform: scale(1.1);
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.color-picker-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-secondary, .btn-primary {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 14px;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--muted);
}

.btn-secondary:hover {
  background: var(--muted);
}

.btn-primary {
  background: var(--brand);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(44, 123, 229, 0.3);
}

[data-theme="dark"] .color-preset {
  border-color: #475569;
}

[data-theme="dark"] .color-picker-content input[type="color"] {
  border-color: #475569;
}

/* ==================== */
/* Reminder Links Feature */
/* ==================== */

/* Links button in edit mode (next to # button) */
.links-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.2s ease;
}

.links-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--brand);
}

.links-btn svg {
  width: 16px;
  height: 16px;
}

[data-theme="dark"] .links-btn {
  color: #94a3b8;
}
[data-theme="dark"] .links-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #60a5fa;
}

/* Left container for reminder title and links toggle */
.reminder-left-container {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.reminder-left-container > a {
  margin-right: 4px;
}

/* Links toggle button in view mode (next to title) */
.reminder-links-toggle {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.reminder-links-toggle:hover {
  transform: scale(1.1);
}

.reminder-links-toggle svg {
  width: 14px;
  height: 14px;
}

[data-theme="dark"] .reminder-links-toggle {
  color: #cbd5e1;
}
[data-theme="dark"] .reminder-links-toggle:hover {
  color: #f1f5f9;
}

[data-theme="dark"] .list-item-links-toggle {
  color: #cbd5e1;
}
[data-theme="dark"] .list-item-links-toggle:hover {
  color: #f1f5f9;
}

/* Links toggle button needs relative positioning for the links overlay */
.reminder-links-toggle {
  position: relative;
}

/* Expanded links container - positioned absolute to scroll with content */
/* Backdrop for link popups */
.links-popup-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  z-index: 9999;
  transition: background 0.25s ease, backdrop-filter 0.25s ease, -webkit-backdrop-filter 0.25s ease;
  pointer-events: none;
}

.links-popup-backdrop.active {
  background: rgba(0, 0, 0, 0.10);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: auto;
}

/* Clone of source item positioned above the backdrop */
.links-source-clone {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.reminder-links-expanded {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10002;
  pointer-events: none;
}

.reminder-links-expanded.open {
  pointer-events: auto;
}

.reminder-links-expanded.open .reminder-link-bubble {
  animation: linkBubbleIn 0.3s ease forwards;
}

.reminder-links-expanded.closing .reminder-link-bubble,
.reminder-links-expanded.closing .link-section-divider {
  animation: linkBubbleOut 0.25s ease forwards;
}

/* Individual link bubble - 30% bigger, color set dynamically via JS */
.reminder-link-bubble {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  transition: filter 0.2s ease, box-shadow 0.2s ease;
  opacity: 0;
  transform: translateX(-20px) scale(0.5);
  white-space: nowrap;
  max-width: fit-content;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.reminder-link-bubble:hover {
  filter: brightness(0.95);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .reminder-link-bubble {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .reminder-link-bubble:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

/* Section divider in expanded links view */
.link-section-divider {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1f2937;
  padding: 9px 16px;
  background: none;
  border: none;
  border-radius: 0;
  animation: linkBubbleIn 0.25s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-fill-mode: backwards;
  white-space: nowrap;
}

[data-theme="dark"] .link-section-divider {
  color: #f1f5f9;
}

@keyframes sectionLightMove {
  0% {
    background-position: 20% 50%;
  }
  100% {
    background-position: 80% 50%;
  }
}

/* Animation keyframes for link bubbles - fly out from behind icon */
@keyframes linkBubbleIn {
  from {
    opacity: 0;
    transform: translateX(-20px) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes linkBubbleOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(0) scale(1);
  }
}

/* ==================== */
/* Icon Link Indicator */
/* ==================== */

/* Blue corner indicator on icons with links */
.icon-link-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 24px 24px;
  border-color: transparent transparent var(--brand) transparent;
  cursor: pointer;
  border-radius: 0 0 12px 0;
  transition: border-color 0.2s ease;
  z-index: 4;
}

.icon-link-indicator:hover {
  border-color: transparent transparent #2563eb transparent;
}

/* Ensure icon button is position relative for indicator */
.icon-button {
  position: relative;
}

[data-theme="dark"] .icon-link-indicator {
  border-color: transparent transparent #60a5fa transparent;
}

[data-theme="dark"] .icon-link-indicator:hover {
  border-color: transparent transparent #93c5fd transparent;
}

/* Glass mode variant */
[data-style="glass"] .icon-link-indicator {
  border-color: transparent transparent rgba(59, 130, 246, 0.8) transparent;
}

[data-style="glass"] .icon-link-indicator:hover {
  border-color: transparent transparent rgba(37, 99, 235, 0.9) transparent;
}


/* ==================== */
/* Icon Task Indicator */
/* ==================== */

/* Green corner indicator on icons with tasks (opposite corner from links) */
.icon-task-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 18px 18px 0 0;
  border-color: #22c55e transparent transparent transparent;
  cursor: pointer;
  border-radius: 8px 0 0 0;
  transition: border-color 0.2s ease;
  z-index: 4;
}

.icon-task-indicator:hover {
  border-color: #16a34a transparent transparent transparent;
}

[data-theme="dark"] .icon-task-indicator {
  border-color: #22c55e transparent transparent transparent;
}

[data-theme="dark"] .icon-task-indicator:hover {
  border-color: #4ade80 transparent transparent transparent;
}

/* Glass mode variant */
[data-style="glass"] .icon-task-indicator {
  border-color: rgba(78, 173, 107, 0.8) transparent transparent transparent;
}

[data-style="glass"] .icon-task-indicator:hover {
  border-color: rgba(22, 163, 74, 0.9) transparent transparent transparent;
}


/* ================================ */
/* Unified Icon Indicator (purple) */
/* ================================ */
.icon-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2eb8ff !important;
  cursor: pointer;
  z-index: 5;
  transition: transform 0.15s ease, filter 0.15s ease;
  box-shadow: 0 0 6px 2px rgba(35, 168, 255, 0.5), 0 0 12px 4px rgba(35, 168, 255, 0.25);
}
.icon-indicator:hover {
  transform: scale(1.15);
  filter: brightness(1.2);
}
[data-theme="dark"] .icon-indicator {
  background: #4ac4ff !important;
  box-shadow: 0 0 8px 3px rgba(74, 196, 255, 0.55), 0 0 16px 6px rgba(74, 196, 255, 0.3);
}

/* Unified indicator popup */
.icon-indicator-expanded {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  padding: 20px 24px;
}
.icon-indicator-expanded::before {
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: 32px;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.08) 50%, transparent 75%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  -webkit-mask-image: radial-gradient(ellipse at center, black 50%, transparent 80%);
  mask-image: radial-gradient(ellipse at center, black 50%, transparent 80%);
  pointer-events: none;
  z-index: -1;
}
[data-theme="dark"] .icon-indicator-expanded::before {
  background: radial-gradient(ellipse at center, rgba(30, 41, 59, 0.35) 0%, rgba(30, 41, 59, 0.1) 55%, transparent 75%);
}
.icon-indicator-expanded.open {
  pointer-events: auto;
}
.icon-indicator-expanded.closing {
  animation: indicatorFadeOut 0.2s ease forwards;
  pointer-events: none;
}
@keyframes indicatorFadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95); }
}
.icon-indicator-section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
  padding: 2px 0;
  opacity: 0;
  animation: linkBubbleIn 0.25s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.icon-indicator-section-title.section-gap {
  margin-top: 12px;
}
.icon-indicator-expanded .reminder-task-bubble,
.icon-indicator-expanded .reminder-link-bubble {
  animation: linkBubbleIn 0.3s ease forwards;
}

/* ==================== */
/* Links Modal Styling */
/* ==================== */

.reminder-links-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2500; /* above card-edit-modal (2000) so links are editable inside it */
}

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

.reminder-links-dialog {
  background: var(--card);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 685px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.reminder-links-dialog h3 {
  margin: 0 0 20px;
  font-size: 20px;
  color: var(--text);
}

.reminder-links-content {
  margin-bottom: 20px;
}

.reminder-links-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.reminder-link-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.5fr) auto auto;
  gap: 8px;
  align-items: center;
  transition: background 0.15s ease, transform 0.15s ease;
  padding: 4px;
  margin: -4px;
  border-radius: 8px;
}

.reminder-link-row.section-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  background: #f1f5f9;
  border-radius: 8px;
}

[data-theme="dark"] .reminder-link-row.section-row {
  background: #334155;
}

/* Drag handle */
.link-drag-handle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--muted);
  opacity: 0.5;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.link-drag-handle:hover {
  opacity: 1;
  color: var(--text);
}

.reminder-link-row.dragging {
  opacity: 0.5;
  background: rgba(59, 130, 246, 0.1);
}

.reminder-link-row.drag-over-top {
  box-shadow: 0 -2px 0 0 var(--brand);
}

.reminder-link-row.drag-over-bottom {
  box-shadow: 0 2px 0 0 var(--brand);
}

/* Top drop zone for dragging to first position */
.link-top-drop-zone {
  height: 8px;
  margin-bottom: 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.link-top-drop-zone.drag-over {
  height: 24px;
  background: rgba(59, 130, 246, 0.15);
  border: 2px dashed var(--brand);
}

/* Section title input */
.section-title-input {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  background: var(--card);
  color: var(--text);
}

.section-title-input::placeholder {
  font-weight: 400;
  color: var(--muted);
}

[data-theme="dark"] .section-title-input {
  background: #1e293b;
  border-color: #475569;
}

.reminder-link-row input {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-width: 0;
}

.reminder-link-row input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}

.btn-delete-link {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.2s ease;
}

.btn-delete-link:hover {
  background: #fee2e2;
  color: var(--danger);
}

[data-theme="dark"] .btn-delete-link:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* File badge in link rows */
.link-file-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.05);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  flex-shrink: 0;
}
[data-theme="dark"] .link-file-badge {
  background: rgba(255, 255, 255, 0.08);
}

/* File bubble in view mode popup */
.reminder-file-bubble::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 14px;
  margin-right: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='12' height='14' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'%3E%3C/path%3E%3Cpolyline points='14 2 14 8 20 8'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center;
  vertical-align: middle;
}

/* Add buttons container */
.links-modal-add-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px;
  margin: -4px;
}
.links-modal-add-row {
  display: flex;
  gap: 8px;
}
.btn-add-link.btn-full-width {
  width: 100%;
  flex: none;
}

.btn-add-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  padding: 8px 16px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 20px;
  color: #3730a3;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.btn-add-link:hover {
  background: #e0e7ff;
  border-color: #a5b4fc;
  transform: scale(1.02);
}

.btn-add-link svg {
  flex-shrink: 0;
}

[data-theme="dark"] .btn-add-link {
  background: #312e81;
  border-color: #4338ca;
  color: #a5b4fc;
}

[data-theme="dark"] .btn-add-link:hover {
  background: #3730a3;
  border-color: #4f46e5;
}

.reminder-links-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

[data-theme="dark"] .reminder-link-row input {
  background: #334155;
  border-color: #475569;
}

[data-theme="dark"] .reminder-link-row input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ==================== */
/* Icon Links Color Picker */
/* ==================== */

.icon-links-dialog {
  max-width: 610px;
}

.icon-links-mode-hint {
  font-size: 13px;
  color: var(--muted);
  margin: -12px 0 16px 0;
}

/* Color circle button in link row */
.icon-link-color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

.icon-link-color-btn:hover {
  transform: scale(1.1);
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .icon-link-color-btn {
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .icon-link-color-btn:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Color picker popover */
.link-color-popover {
  position: fixed;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  padding: 12px;
  z-index: 2600;
  min-width: 200px;
}

.link-color-popover-header {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 10px;
}

.link-color-popover-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.link-color-input {
  width: 36px;
  height: 36px;
  padding: 2px;
  border: 2px solid var(--muted);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  flex-shrink: 0;
}

.link-color-input:hover {
  border-color: var(--brand);
}

.link-color-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.color-preset-small {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  padding: 0;
}

.color-preset-small:hover {
  transform: scale(1.15);
  border-color: var(--brand);
}

/* Dark mode */
[data-theme="dark"] .link-color-popover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .link-color-input {
  border-color: #475569;
}

[data-theme="dark"] .color-preset-small {
  border-color: rgba(255, 255, 255, 0.1);
}

/* ==================== */
/* Tasks Feature Styling */
/* ==================== */

/* Tasks button in edit mode (next to links button) */
.tasks-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.2s ease;
}

.tasks-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--brand);
}

.tasks-btn svg {
  width: 16px;
  height: 16px;
}

[data-theme="dark"] .tasks-btn {
  color: #94a3b8;
}
[data-theme="dark"] .tasks-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #60a5fa;
}

/* List item tasks button */
.list-item-tasks-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.list-item-tasks-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--brand);
}

.list-item-tasks-btn svg {
  width: 14px;
  height: 14px;
}

[data-theme="dark"] .list-item-tasks-btn {
  color: #94a3b8;
}
[data-theme="dark"] .list-item-tasks-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #60a5fa;
}

/* Tasks toggle button in view mode (next to title) */
.reminder-tasks-toggle,
.list-item-tasks-toggle {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  transition: all 0.2s ease;
  flex-shrink: 0;
  position: relative;
}

.reminder-tasks-toggle:hover,
.list-item-tasks-toggle:hover {
  transform: scale(1.1);
}

.reminder-tasks-toggle svg,
.list-item-tasks-toggle svg {
  width: 14px;
  height: 14px;
}

[data-theme="dark"] .reminder-tasks-toggle,
[data-theme="dark"] .list-item-tasks-toggle {
  color: #cbd5e1;
}
[data-theme="dark"] .reminder-tasks-toggle:hover,
[data-theme="dark"] .list-item-tasks-toggle:hover {
  color: #f1f5f9;
}

/* Subtask notes toggle button */
.list-item-notes-toggle {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: all 0.2s ease;
  flex-shrink: 0;
  opacity: 0.4;
}
.list-item-notes-toggle.has-note {
  color: var(--brand);
  opacity: 0.7;
}
.list-item-notes-toggle:hover {
  transform: scale(1.1);
  opacity: 1;
}
.list-item-notes-toggle svg {
  width: 14px;
  height: 14px;
}
[data-theme="dark"] .list-item-notes-toggle {
  color: #64748b;
}
[data-theme="dark"] .list-item-notes-toggle.has-note {
  color: #cbd5e1;
}
[data-theme="dark"] .list-item-notes-toggle:hover {
  color: #f1f5f9;
}

/* Expanded tasks container */
.reminder-tasks-expanded {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10000;
  pointer-events: none;
}

.reminder-tasks-expanded.open {
  pointer-events: auto;
}

.reminder-tasks-expanded.open .reminder-task-bubble {
  animation: linkBubbleIn 0.3s ease forwards;
}

.reminder-tasks-expanded.closing .reminder-task-bubble {
  animation: linkBubbleOut 0.25s ease forwards;
}

/* Individual task bubble - color-coded with glass effect */
.reminder-task-bubble {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  opacity: 0;
  transform: translateX(-20px) scale(0.5);
  white-space: nowrap;
  max-width: fit-content;
  position: relative;
  z-index: 0;
  isolation: isolate;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px rgba(255,255,255,0.9),
    inset 0 -2px 6px rgba(0,0,0,0.03);
}
/* Glass shine overlay for task bubbles */
.reminder-task-bubble::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 25% 70% at 12% 30%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.18) 40%, transparent 70%),
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(255,255,255,0.65) 0%, rgba(255,255,255,0.3) 35%, rgba(255,255,255,0.06) 60%, transparent 80%),
    linear-gradient(160deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.15) 25%, transparent 50%, rgba(255,255,255,0.02) 75%, rgba(255,255,255,0.08) 100%);
  pointer-events: none;
  z-index: -1;
}
/* Glass rim for task bubbles */
.reminder-task-bubble::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.4),
    inset 0 2px 4px rgba(255,255,255,0.55),
    inset 0 -2px 4px rgba(0,0,0,0.04),
    inset 2px 0 4px rgba(255,255,255,0.1),
    inset -2px 0 4px rgba(255,255,255,0.1);
  pointer-events: none;
  z-index: -1;
}

.reminder-task-bubble:hover {
  filter: brightness(0.95);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 2px rgba(255,255,255,0.9),
    inset 0 -2px 6px rgba(0,0,0,0.03);
}

.reminder-task-bubble:active {
  transform: scale(0.95);
}

/* Task bubble color variants - Light mode */
.task-bubble-red {
  background: #fecaca;
  border: 2px solid rgba(248, 113, 113, 0.5);
  color: #991b1b;
}

.task-bubble-yellow {
  background: #fde68a;
  border: 2px solid rgba(251, 191, 36, 0.5);
  color: #92400e;
}

.task-bubble-green {
  background: #a7f3d0;
  border: 2px solid rgba(52, 211, 153, 0.5);
  color: #065f46;
}

.task-bubble-orange {
  background: #fed7aa;
  border: 2px solid rgba(251, 146, 60, 0.5);
  color: #9a3412;
}

.task-bubble-blue {
  background: #bfdbfe;
  border: 2px solid rgba(96, 165, 250, 0.5);
  color: #1e40af;
}

/* Task bubble color variants - Dark mode */
[data-theme="dark"] .task-bubble-red {
  background: #7f1d1d;
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

[data-theme="dark"] .task-bubble-yellow {
  background: #78350f;
  border-color: rgba(251, 191, 36, 0.4);
  color: #fef08a;
}

[data-theme="dark"] .task-bubble-green {
  background: #064e3b;
  border-color: rgba(52, 211, 153, 0.4);
  color: #a7f3d0;
}

[data-theme="dark"] .task-bubble-orange {
  background: #7c2d12;
  border-color: rgba(251, 146, 60, 0.4);
  color: #fed7aa;
}

[data-theme="dark"] .task-bubble-blue {
  background: #1e3a5f;
  border-color: rgba(96, 165, 250, 0.4);
  color: #bfdbfe;
}

[data-theme="dark"] .reminder-task-bubble {
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.4),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -2px 6px rgba(0,0,0,0.12);
}
[data-theme="dark"] .reminder-task-bubble::before {
  background:
    radial-gradient(ellipse 25% 70% at 12% 30%, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.07) 40%, transparent 70%),
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.1) 35%, rgba(255,255,255,0.02) 60%, transparent 80%),
    linear-gradient(160deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 25%, transparent 50%, rgba(0,0,0,0.04) 75%, rgba(255,255,255,0.04) 100%);
}
[data-theme="dark"] .reminder-task-bubble::after {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.1),
    inset 0 2px 4px rgba(255,255,255,0.15),
    inset 0 -2px 4px rgba(0,0,0,0.18),
    inset 2px 0 4px rgba(255,255,255,0.04),
    inset -2px 0 4px rgba(255,255,255,0.04);
}

[data-theme="dark"] .reminder-task-bubble:hover {
  filter: brightness(1.1);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -2px 6px rgba(0,0,0,0.12);
}

/* Drag styling for task bubbles */
.reminder-task-bubble.dragging {
  opacity: 0.5 !important;
  cursor: grabbing;
}

/* Task drop indicator (blue line) */
.task-drop-indicator {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(44, 123, 229, 0.5);
  pointer-events: none;
  z-index: 10001;
}

[data-theme="dark"] .task-drop-indicator {
  background: var(--brand);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

/* Tasks Modal Styling (reuses links modal structure) */
.reminder-tasks-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

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

.reminder-tasks-dialog {
  background: var(--card);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 550px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.reminder-tasks-dialog h3 {
  margin: 0 0 20px;
  font-size: 20px;
  color: var(--text);
}

.reminder-tasks-content {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
}

.reminder-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.reminder-tasks-list {
  position: relative;
  padding-top: 4px;
}

.reminder-task-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  cursor: grab;
  background: var(--card);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: opacity 0.15s ease;
}

.reminder-task-row:active {
  cursor: grabbing;
}

.reminder-task-row.dragging {
  opacity: 0.4;
}

/* Drag handle for task rows */
.task-row-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: grab;
  padding: 4px;
  border-radius: 4px;
}

.task-row-drag-handle:hover {
  color: var(--text);
  background: var(--bg);
}

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

/* Drop indicator line */
.task-row-drop-indicator {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand);
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
  z-index: 10;
}

.task-row-drop-indicator.visible {
  opacity: 1;
}

.reminder-task-row .task-title-input {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

.reminder-task-row .task-title-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}

[data-theme="dark"] .reminder-task-row .task-title-input {
  background: #334155;
  border-color: #475569;
}

[data-theme="dark"] .reminder-task-row .task-title-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Color selector buttons */
.task-color-selector {
  display: flex;
  gap: 6px;
}

.task-color-btn {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.task-color-btn:hover {
  transform: scale(1.1);
}

.task-color-btn.active {
  box-shadow: 0 0 0 3px var(--brand);
  transform: scale(1.1);
}

[data-theme="dark"] .task-color-btn.active {
  box-shadow: 0 0 0 3px var(--brand);
}

/* Color buttons match view mode bubble colors */
.task-color-btn.red {
  background: #fecaca;
  border-color: #f87171;
}

.task-color-btn.yellow {
  background: #fde68a;
  border-color: #fbbf24;
}

.task-color-btn.green {
  background: #a7f3d0;
  border-color: #34d399;
}

.task-color-btn.orange {
  background: #fed7aa;
  border-color: #fb923c;
}

.task-color-btn.blue {
  background: #bfdbfe;
  border-color: #60a5fa;
}

[data-theme="dark"] .task-color-btn.red {
  background: #7f1d1d;
  border-color: #f87171;
}

[data-theme="dark"] .task-color-btn.yellow {
  background: #78350f;
  border-color: #fbbf24;
}

[data-theme="dark"] .task-color-btn.green {
  background: #064e3b;
  border-color: #34d399;
}

[data-theme="dark"] .task-color-btn.orange {
  background: #7c2d12;
  border-color: #fb923c;
}

[data-theme="dark"] .task-color-btn.blue {
  background: #1e3a5f;
  border-color: #60a5fa;
}

.btn-delete-task {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.2s ease;
}

.btn-delete-task:hover {
  background: #fee2e2;
  color: var(--danger);
}

[data-theme="dark"] .btn-delete-task:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-add-task {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 2px dashed #c7d2fe;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-task:hover {
  background: #e0e7ff;
  border-color: #a5b4fc;
}

[data-theme="dark"] .btn-add-task {
  background: #374151;
  border-color: #4b5563;
  color: #cbd5e1;
}

[data-theme="dark"] .btn-add-task:hover {
  background: #4b5563;
}

.reminder-tasks-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ===== Image Editor Modal ===== */
.image-editor-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 3500;
}
.image-editor-modal[hidden] { display: none; }
.image-editor-modal:not([hidden]) { display: block; }

.image-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.image-editor-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  max-width: 90vw;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.image-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.image-editor-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.image-editor-body {
  padding: 24px;
}

.image-editor-preview {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.image-editor-frame {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  background: #e2e8f0;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
  cursor: grab;
  position: relative;
}

.image-editor-frame.square-frame {
  border-radius: 12px;
}

.image-editor-frame:active {
  cursor: grabbing;
}

.image-editor-frame img {
  position: absolute;
  user-select: none;
  -webkit-user-drag: none;
}

.image-editor-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.image-editor-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.image-editor-control label {
  font-size: 14px;
  font-weight: 500;
  min-width: 50px;
  color: var(--text);
}

.image-editor-control input[type="range"] {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  appearance: none;
  cursor: pointer;
}

.image-editor-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.image-editor-control input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

#image-editor-scale-value {
  font-size: 13px;
  color: var(--muted);
  min-width: 45px;
  text-align: right;
}

#image-editor-choose {
  width: 100%;
  padding: 10px 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: transparent;
  color: var(--brand);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

#image-editor-choose:hover {
  background: #f0f9ff;
  border-color: var(--brand);
}

.image-editor-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
}

.image-editor-footer .btn {
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

.image-editor-footer .btn.secondary {
  background: #e5e7eb;
  color: #374151;
}

.image-editor-footer .btn.secondary:hover {
  background: #d1d5db;
}

.image-editor-footer .btn.primary {
  background: var(--brand);
  color: white;
}

.image-editor-footer .btn.primary:hover {
  background: #1d4ed8;
}

/* Dark mode for image editor */
[data-theme="dark"] .image-editor-dialog {
  background: var(--card);
  border: 1px solid #334155;
}

[data-theme="dark"] .image-editor-header {
  border-bottom-color: #334155;
}

[data-theme="dark"] .image-editor-frame {
  background: #334155;
}

[data-theme="dark"] .image-editor-control input[type="range"] {
  background: #334155;
}

[data-theme="dark"] #image-editor-choose {
  border-color: #475569;
}

[data-theme="dark"] #image-editor-choose:hover {
  background: #1e3a5f;
}

[data-theme="dark"] .image-editor-footer {
  border-top-color: #334155;
}

[data-theme="dark"] .image-editor-footer .btn.secondary {
  background: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .image-editor-footer .btn.secondary:hover {
  background: #475569;
}

/* Profile photo with transform support */
.profile-photo-container {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0,0,0,0.18);
  position: relative;
  flex-shrink: 0;
  cursor: default;
}

/* Profile photo wrapper (allows badge to overflow the clipped circle) */
.profile-photo-wrapper {
  position: relative;
  flex-shrink: 0;
}

/* Notification badge on profile photo: what is due today or overdue.
   Always shown (it opens the calendar); .is-clear = nothing due. */
.notification-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  z-index: 5;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: #ef4444;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s;
}
.notification-badge[hidden] {
  display: none;
}
.notification-badge:hover {
  transform: scale(1.1);
}
.notification-badge.is-clear {
  padding: 0;
  width: 24px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--muted);
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.notification-badge.is-clear svg { display: block; }
[data-theme="dark"] .notification-badge.is-clear {
  background: #334155;
  color: #cbd5e1;
}

/* Only show pointer cursor in edit mode */
.card.editing .profile-photo-container {
  cursor: pointer;
}

.profile-photo-container .profile-photo {
  position: absolute;
  box-shadow: none;
  border-radius: 0;
}

/* ==================== UNIFIED CARD STYLES ==================== */

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

.unified-subtitle-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  margin-top: 12px;
}

.unified-subtitle-wrapper:first-child {
  margin-top: 0;
}

/* Collapse button for subtitle sections */
.subtitle-collapse-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
  color: var(--text);
}

.subtitle-collapse-btn:hover {
  opacity: 1;
}

.subtitle-collapse-btn svg {
  transition: transform 0.2s ease;
}

.subtitle-collapse-btn.collapsed svg {
  transform: rotate(-90deg);
}

.unified-subtitle {
  font-size: 21px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: #1f2937;
  padding: 0;
  background: transparent;
  border-radius: 0;
  cursor: default;
}

[data-theme="dark"] .unified-subtitle {
  background: transparent;
  color: #e2e8f0;
}

.card.editing .unified-subtitle {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.card.editing .unified-subtitle:hover {
  background: #f1f5f9;
}

[data-theme="dark"] .card.editing .unified-subtitle:hover {
  background: #334155;
}

.unified-content-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Unified Icons Group - horizontal row */
.unified-icons-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px; /* Extra space before subtasks/reminders below */
}

/* Unified Subtasks Group */
.unified-subtasks-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.unified-subtask-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f7fafc;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 10px 16px 10px 20px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  gap: 12px;
  font-size: 14px !important;
  min-height: 44px;
  max-height: 44px;
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.06),
    0 8px 30px rgba(0,0,0,0.04),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}
.unified-subtask-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 25% 70% at 12% 30%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.18) 40%, transparent 70%),
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(255,255,255,0.65) 0%, rgba(255,255,255,0.3) 35%, rgba(255,255,255,0.06) 60%, transparent 80%),
    linear-gradient(160deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.15) 25%, transparent 50%, rgba(255,255,255,0.02) 75%, rgba(255,255,255,0.08) 100%);
  pointer-events: none;
  z-index: 1;
}
.unified-subtask-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.4),
    inset 0 2px 4px rgba(255,255,255,0.55),
    inset 0 -2px 4px rgba(0,0,0,0.04),
    inset 2px 0 4px rgba(255,255,255,0.1),
    inset -2px 0 4px rgba(255,255,255,0.1);
  pointer-events: none;
  z-index: 2;
}

.unified-subtask-item:hover {
  transform: scale(1.03);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.08),
    0 10px 35px rgba(0,0,0,0.05),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}

[data-theme="dark"] .unified-subtask-item {
  background: #334155;
  border-color: rgba(148,163,184,0.1);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.25),
    0 8px 30px rgba(0,0,0,0.15),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}
[data-theme="dark"] .unified-subtask-item::before {
  background:
    radial-gradient(ellipse 25% 70% at 12% 30%, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.07) 40%, transparent 70%),
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.1) 35%, rgba(255,255,255,0.02) 60%, transparent 80%),
    linear-gradient(160deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 25%, transparent 50%, rgba(0,0,0,0.04) 75%, rgba(255,255,255,0.04) 100%);
}
[data-theme="dark"] .unified-subtask-item::after {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.1),
    inset 0 2px 4px rgba(255,255,255,0.15),
    inset 0 -2px 4px rgba(0,0,0,0.18),
    inset 2px 0 4px rgba(255,255,255,0.04),
    inset -2px 0 4px rgba(255,255,255,0.04);
}

[data-theme="dark"] .unified-subtask-item:hover {
  box-shadow:
    0 6px 20px rgba(0,0,0,0.3),
    0 10px 35px rgba(0,0,0,0.2),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}

/* Elevate pill content above glass overlays */
.unified-subtask-item > *,
.unified-reminder-item > *,
.unified-copypaste-item > *,
.reminder-item > *,
.list-item > *,
.copy-paste-item > * {
  position: relative;
  z-index: 3;
}

.unified-subtask-item a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px !important;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unified-subtask-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.unified-subtask-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.unified-subtask-left > a {
  margin-right: 4px;
  min-width: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Priority Toggle Button (Quick Access integration) */
.priority-toggle-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.priority-toggle-btn:hover {
  transform: scale(1.1);
}

.priority-toggle-btn.active {
  color: var(--brand);
}

.priority-toggle-btn.active:hover {
  transform: scale(1.1);
}

.priority-toggle-btn svg {
  width: 14px;
  height: 14px;
}

[data-theme="dark"] .priority-toggle-btn {
  color: #cbd5e1;
}

[data-theme="dark"] .priority-toggle-btn:hover {
  color: #f1f5f9;
}

[data-theme="dark"] .priority-toggle-btn.active {
  color: #cbd5e1;
}

/* Priority Highlighted Items (in Quick Access) - color is applied inline via JS */
/* This class is no longer used but kept for reference */

/* Unified Reminders Group */
.unified-reminders-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.unified-reminder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f7fafc;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 10px 16px 10px 20px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  gap: 12px;
  font-size: 14px !important;
  min-height: 44px;
  max-height: 44px;
  box-sizing: border-box;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.06),
    0 8px 30px rgba(0,0,0,0.04),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}

.unified-reminder-item:hover {
  transform: scale(1.03);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.08),
    0 10px 35px rgba(0,0,0,0.05),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}

[data-theme="dark"] .unified-reminder-item {
  background: #334155;
  border-color: rgba(148,163,184,0.1);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.25),
    0 8px 30px rgba(0,0,0,0.15),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}

[data-theme="dark"] .unified-reminder-item:hover {
  box-shadow:
    0 6px 20px rgba(0,0,0,0.3),
    0 10px 35px rgba(0,0,0,0.2),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}

/* Progress bar for calendar reminders */
.unified-reminder-item {
  position: relative;
  z-index: 0;
  overflow: hidden;
}

.unified-reminder-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--progress-width, 100%);
  background: var(--progress-color, transparent);
  border-radius: inherit;
  z-index: -1;
  transition: width 0.3s ease;
}

/* Progress bar colors - light theme (opaque for consistency) */
.unified-reminder-item[data-progress-state="green"]::before {
  background: #bbf7d0;
}
.unified-reminder-item[data-progress-state="yellow"]::before {
  background: #fde68a;
}
.unified-reminder-item[data-progress-state="orange"]::before {
  background: #fed7aa;
}
.unified-reminder-item[data-progress-state="red"]::before {
  background: #fecaca;
}

/* Progress bar colors - dark theme with subtle glow */
[data-theme="dark"] .unified-reminder-item[data-progress-state="green"]::before {
  background: #1a7a3d;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.25), inset 0 0 8px rgba(34, 197, 94, 0.1);
}
[data-theme="dark"] .unified-reminder-item[data-progress-state="yellow"]::before {
  background: #c89b18;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.25), inset 0 0 8px rgba(234, 179, 8, 0.1);
}
[data-theme="dark"] .unified-reminder-item[data-progress-state="orange"]::before {
  background: #d4520e;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.25), inset 0 0 8px rgba(249, 115, 22, 0.1);
}
[data-theme="dark"] .unified-reminder-item[data-progress-state="red"]::before {
  background: #c82020;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.25), inset 0 0 8px rgba(239, 68, 68, 0.1);
}


/* Glass shine overlay for reminders (::after since ::before is progress bar) */
.unified-reminder-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 25% 70% at 12% 30%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.18) 40%, transparent 70%),
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(255,255,255,0.65) 0%, rgba(255,255,255,0.3) 35%, rgba(255,255,255,0.06) 60%, transparent 80%),
    linear-gradient(160deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.15) 25%, transparent 50%, rgba(255,255,255,0.02) 75%, rgba(255,255,255,0.08) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.4),
    inset 0 2px 4px rgba(255,255,255,0.55),
    inset 0 -2px 4px rgba(0,0,0,0.04),
    inset 2px 0 4px rgba(255,255,255,0.1),
    inset -2px 0 4px rgba(255,255,255,0.1);
  pointer-events: none;
  z-index: 1;
}
[data-theme="dark"] .unified-reminder-item::after {
  background:
    radial-gradient(ellipse 25% 70% at 12% 30%, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.07) 40%, transparent 70%),
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.1) 35%, rgba(255,255,255,0.02) 60%, transparent 80%),
    linear-gradient(160deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 25%, transparent 50%, rgba(0,0,0,0.04) 75%, rgba(255,255,255,0.04) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.1),
    inset 0 2px 4px rgba(255,255,255,0.15),
    inset 0 -2px 4px rgba(0,0,0,0.18),
    inset 2px 0 4px rgba(255,255,255,0.04),
    inset -2px 0 4px rgba(255,255,255,0.04);
}

.unified-reminder-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.unified-reminder-left > a {
  margin-right: 4px;
}

.unified-reminder-left a.reminder-title {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unified-reminder-item .days-badge {
  text-align: right;
  font-weight: 500;
  padding: 0;
  background: none !important;
  border-radius: 0;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--text);
}

.unified-reminder-edit-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.unified-reminder-edit-btns button {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(0,0,0,0.05);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}

.unified-reminder-edit-btns button:hover {
  background: rgba(0,0,0,0.1);
  color: var(--brand);
}

[data-theme="dark"] .unified-reminder-edit-btns button {
  background: rgba(255,255,255,0.1);
}

[data-theme="dark"] .unified-reminder-edit-btns button:hover {
  background: rgba(255,255,255,0.2);
}

/* Unified Copy-Paste Group */
.unified-copypaste-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.unified-copypaste-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f7fafc;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 10px 16px 10px 20px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  gap: 12px;
  font-size: 14px !important;
  min-height: 44px;
  max-height: 44px;
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.06),
    0 8px 30px rgba(0,0,0,0.04),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}
.unified-copypaste-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 25% 70% at 12% 30%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.18) 40%, transparent 70%),
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(255,255,255,0.65) 0%, rgba(255,255,255,0.3) 35%, rgba(255,255,255,0.06) 60%, transparent 80%),
    linear-gradient(160deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.15) 25%, transparent 50%, rgba(255,255,255,0.02) 75%, rgba(255,255,255,0.08) 100%);
  pointer-events: none;
  z-index: 1;
}
.unified-copypaste-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.4),
    inset 0 2px 4px rgba(255,255,255,0.55),
    inset 0 -2px 4px rgba(0,0,0,0.04),
    inset 2px 0 4px rgba(255,255,255,0.1),
    inset -2px 0 4px rgba(255,255,255,0.1);
  pointer-events: none;
  z-index: 2;
}

.unified-copypaste-item:hover {
  transform: scale(1.03);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.08),
    0 10px 35px rgba(0,0,0,0.05),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}

[data-theme="dark"] .unified-copypaste-item {
  background: #334155;
  border-color: rgba(148,163,184,0.1);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.25),
    0 8px 30px rgba(0,0,0,0.15),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}
[data-theme="dark"] .unified-copypaste-item::before {
  background:
    radial-gradient(ellipse 25% 70% at 12% 30%, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.07) 40%, transparent 70%),
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.1) 35%, rgba(255,255,255,0.02) 60%, transparent 80%),
    linear-gradient(160deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 25%, transparent 50%, rgba(0,0,0,0.04) 75%, rgba(255,255,255,0.04) 100%);
}
[data-theme="dark"] .unified-copypaste-item::after {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.1),
    inset 0 2px 4px rgba(255,255,255,0.15),
    inset 0 -2px 4px rgba(0,0,0,0.18),
    inset 2px 0 4px rgba(255,255,255,0.04),
    inset -2px 0 4px rgba(255,255,255,0.04);
}

[data-theme="dark"] .unified-copypaste-item:hover {
  box-shadow:
    0 6px 20px rgba(0,0,0,0.3),
    0 10px 35px rgba(0,0,0,0.2),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}

/* Color Swatch Group - flexbox container that wraps tightly */
.unified-swatch-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

/* Color Swatch - compact copy-paste item for color codes */
.unified-copypaste-item.color-swatch {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  min-width: 60px;
  justify-content: center;
}

.unified-copypaste-item.color-swatch .unified-copypaste-text {
  color: inherit;
}

.unified-copypaste-item.color-swatch .copy-paste-icon {
  color: inherit;
  opacity: 0.7;
  display: none;
}

.card.editing .unified-copypaste-item.color-swatch .copy-paste-icon {
  display: flex;
}

.card.editing .unified-copypaste-item.color-swatch:hover .copy-paste-icon {
  opacity: 1;
}

.unified-copypaste-text {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 14px !important;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Add Item Tile - Circular with blue accent */
.unified-add-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 50%;
  color: #6366f1;
  font-size: 24px;
  font-weight: 400;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 2px 8px rgba(99,102,241,0.1);
}

.unified-add-tile:hover {
  transform: scale(1.05);
  background: #e0e7ff;
  box-shadow: 0 4px 12px rgba(99,102,241,0.15);
  color: #4f46e5;
}

[data-theme="dark"] .unified-add-tile {
  background: #312e81;
  border-color: #4338ca;
  color: #a5b4fc;
  box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}

[data-theme="dark"] .unified-add-tile:hover {
  background: #3730a3;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
  color: #c7d2fe;
}

/* Add Subtitle Button */
.unified-add-subtitle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  margin-top: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  width: fit-content;
}

.unified-add-subtitle:hover {
  background: #f1f5f9;
  border-color: #d1d5db;
  transform: scale(1.02);
}

[data-theme="dark"] .unified-add-subtitle {
  background: #334155;
  border-color: #475569;
  color: #94a3b8;
}

[data-theme="dark"] .unified-add-subtitle:hover {
  background: #3d4f66;
  border-color: #64748b;
}

/* Unified Add Item Popover */
.unified-add-popover {
  min-width: auto;
}

.unified-add-popover button:hover {
  background: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
}

[data-theme="dark"] .unified-add-popover button:hover {
  background: #475569 !important;
  border-color: #6b7280 !important;
}

/* Color picker button for unified subtitles */
.unified-subtitle-wrapper .subtitle-color-picker-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.unified-subtitle-wrapper .subtitle-color-picker-btn:hover {
  opacity: 1;
}

/* ========== Card Notepad Feature ========== */

/* Notepad button in card header */
.card-notepad-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4;
  transition: opacity 0.2s, background 0.2s;
  z-index: 5;
}

.card-notepad-btn:hover {
  opacity: 0.8;
  background: rgba(0, 0, 0, 0.05);
}

.card-notepad-btn svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

/* Notepad button has content indicator */
.card-notepad-btn.has-note {
  opacity: 0.7;
}

.card-notepad-btn.has-note::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  background: var(--brand);
  border-radius: 50%;
}

/* Hide notepad button in edit mode */
.card.editing .card-notepad-btn {
  display: none;
}

/* Quick-add "+" (view mode), left of the notepad button. Appears on card
   hover / keyboard focus; always shown on phones and touch screens. Collapsed
   cards hide it with their other children. */
.card-add-item-btn {
  position: absolute;
  top: 16px;
  right: 50px;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  z-index: 5;
}
.card-add-item-btn svg {
  width: 18px;
  height: 18px;
}
section.card:hover > .card-add-item-btn,
.card-add-item-btn:focus-visible {
  opacity: 0.55;
}
.card-add-item-btn:hover {
  opacity: 1 !important;
  color: var(--brand);
  background: rgba(0, 0, 0, 0.05);
}
body[data-device="mobile"] .card-add-item-btn { opacity: 0.55; }
@media (hover: none) {
  .card-add-item-btn { opacity: 0.55; }
}
.card.editing .card-add-item-btn,
.app-main.edit-mode-tiles .card-add-item-btn {
  display: none;
}

/* Notepad popover */
.notepad-popover {
  position: absolute;
  z-index: 1000;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow), 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 16px;
  width: 384px;
  max-width: calc(100vw - 24px);
}

.notepad-view {
  min-height: 150px;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.2s;
}

.notepad-view:hover {
  border-color: var(--brand);
}

.notepad-view-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.notepad-view-content:empty + .notepad-view-empty {
  display: block;
}

.notepad-view-empty {
  display: none;
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}

.notepad-view-content ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.notepad-view-content ul ul {
  list-style-type: circle;
  margin-top: 2px;
}

.notepad-view-content li {
  margin: 2px 0;
}

[data-theme="dark"] .notepad-view {
  background: #1e293b;
  border-color: #475569;
}

[data-theme="dark"] .notepad-view:hover {
  border-color: var(--brand);
}

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

.notepad-popover-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.notepad-popover-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--muted);
  opacity: 0.7;
  transition: opacity 0.2s;
}

.notepad-popover-close:hover {
  opacity: 1;
}

/* Notepad Toolbar */
.notepad-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  margin-bottom: 8px;
  background: var(--bg);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.notepad-toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.notepad-toolbar-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.notepad-toolbar-btn:active {
  background: rgba(0, 0, 0, 0.1);
}

.notepad-toolbar-btn.active {
  background: var(--brand);
  color: white;
}

.notepad-toolbar-divider {
  width: 1px;
  height: 20px;
  background: #e5e7eb;
  margin: 0 6px;
}

[data-theme="dark"] .notepad-toolbar {
  background: #1e293b;
  border-color: #475569;
}

[data-theme="dark"] .notepad-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .notepad-toolbar-btn:active {
  background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .notepad-toolbar-divider {
  background: #475569;
}

/* Notepad editor heading styles */
.notepad-editor h1,
.notepad-editor h2,
.notepad-editor h3,
.notepad-editor h4,
.notepad-editor h5,
.notepad-editor h6 {
  margin: 0.5em 0 0.3em 0;
  font-weight: 600;
  line-height: 1.3;
}

.notepad-editor h1 { font-size: 1.5em; }
.notepad-editor h2 { font-size: 1.3em; }
.notepad-editor h3 { font-size: 1.15em; }
.notepad-editor h4 { font-size: 1em; }
.notepad-editor h5 { font-size: 0.9em; }
.notepad-editor h6 { font-size: 0.85em; color: var(--muted); }

.notepad-editor {
  width: 100%;
  min-height: 150px;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.notepad-editor:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}

.notepad-editor:empty::before {
  content: 'Write your notes here...';
  color: var(--muted);
  font-style: italic;
}

.notepad-editor ul,
.notepad-editor ol {
  margin: 0;
  padding-left: 20px;
}

.notepad-editor ul {
  list-style-type: disc;
}

.notepad-editor ol {
  list-style-type: decimal;
}

.notepad-editor ul ul {
  list-style-type: circle;
  margin-top: 2px;
}
.notepad-editor ul ul ul {
  list-style-type: square;
  margin-top: 2px;
}
.notepad-editor ul ul ul ul {
  list-style-type: disc;
  margin-top: 2px;
}

.notepad-editor ol ol {
  list-style-type: lower-alpha;
  margin-top: 2px;
}
.notepad-editor ol ol ol {
  list-style-type: lower-roman;
  margin-top: 2px;
}
.notepad-editor ol ol ol ol {
  list-style-type: decimal;
  margin-top: 2px;
}

.notepad-editor li {
  margin: 2px 0;
}

.notepad-popover-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.notepad-popover-actions button:not(.notepad-color-btn) {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.notepad-save-btn {
  background: var(--brand);
  color: white;
  border: none;
}

.notepad-save-btn:hover {
  opacity: 0.9;
}

.notepad-cancel-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid #e5e7eb;
}

.notepad-cancel-btn:hover {
  background: var(--bg);
}

/* Dark mode notepad styles */
[data-theme="dark"] .card-notepad-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .notepad-popover {
  background: var(--card);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .notepad-editor {
  background: #1e293b;
  border-color: #475569;
  color: var(--text);
}

[data-theme="dark"] .notepad-editor:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .notepad-cancel-btn {
  border-color: #475569;
  color: #94a3b8;
}

[data-theme="dark"] .notepad-cancel-btn:hover {
  background: #334155;
}

/* Notepad title input */
.notepad-title-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 8px;
}
.notepad-title-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}
.notepad-title-input::placeholder {
  color: var(--muted);
  font-weight: 400;
}
[data-theme="dark"] .notepad-title-input {
  background: #1e293b;
  border-color: #475569;
}
[data-theme="dark"] .notepad-title-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Saved notes list - appears at top of notepad when there are saved notes */
.notepad-saved-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}
.notepad-saved-list[hidden] {
  display: none;
}
[data-theme="dark"] .notepad-saved-list {
  border-color: #475569;
}

/* Saved note bubble */
.notepad-saved-bubble {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: #e6f3ff;
  color: #1f2937;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.notepad-saved-bubble:hover {
  filter: brightness(0.95);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}
[data-theme="dark"] .notepad-saved-bubble {
  background: #475569;
  color: #f1f5f9;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .notepad-saved-bubble:hover {
  filter: brightness(1.1);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

/* Note color button - matches link color button style exactly */
.notepad-color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.15);
  background: #e6f3ff;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  margin-right: auto;
  padding: 0;
  flex-shrink: 0;
}
.notepad-color-btn:hover {
  transform: scale(1.1);
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
[data-theme="dark"] .notepad-color-btn {
  border-color: rgba(255, 255, 255, 0.2);
  background: #475569;
}
[data-theme="dark"] .notepad-color-btn:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Note color picker now uses .link-color-popover classes for consistency */

/* Note Viewer Modal */
.note-viewer-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.note-viewer-modal[hidden] {
  display: none;
}
.note-viewer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}
.note-viewer-dialog {
  position: relative;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 20px;
  width: 480px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
}
.note-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}
.note-viewer-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow: hidden;
}
.note-viewer-header h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-viewer-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.note-viewer-edit,
.note-viewer-delete,
.note-viewer-copy,
.note-viewer-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--muted);
  opacity: 0.7;
  transition: opacity 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.note-viewer-edit:hover,
.note-viewer-copy:hover,
.note-viewer-close:hover {
  opacity: 1;
}
.note-viewer-delete:hover {
  opacity: 1;
  color: var(--danger);
}
.note-viewer-edit svg,
.note-viewer-delete svg,
.note-viewer-copy svg {
  width: 16px;
  height: 16px;
}
.note-viewer-close {
  font-size: 20px;
  line-height: 1;
}
.note-viewer-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
  max-height: 400px;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
}
.note-viewer-content h1,
.note-viewer-content h2,
.note-viewer-content h3,
.note-viewer-content h4,
.note-viewer-content h5,
.note-viewer-content h6 {
  margin: 0.5em 0 0.3em 0;
  font-weight: 600;
  line-height: 1.3;
}
.note-viewer-content h1 { font-size: 1.5em; }
.note-viewer-content h2 { font-size: 1.3em; }
.note-viewer-content h3 { font-size: 1.15em; }
.note-viewer-content h4 { font-size: 1em; }
.note-viewer-content h5 { font-size: 0.9em; }
.note-viewer-content h6 { font-size: 0.85em; color: var(--muted); }
.note-viewer-content ul,
.note-viewer-content ol {
  margin: 0;
  padding-left: 20px;
}
.note-viewer-content ul {
  list-style-type: disc;
}
.note-viewer-content ol {
  list-style-type: decimal;
}
.note-viewer-content ul ul {
  list-style-type: circle;
  margin-top: 2px;
}
.note-viewer-content ol ol {
  list-style-type: lower-alpha;
  margin-top: 2px;
}
.note-viewer-content li {
  margin: 2px 0;
}
[data-theme="dark"] .note-viewer-dialog {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .note-viewer-header {
  border-color: #475569;
}
[data-theme="dark"] .note-viewer-content {
  background: #1e293b;
}
[data-theme="dark"] .note-viewer-backdrop {
  background: rgba(0, 0, 0, 0.7);
}

/* Tasks Summary Toggle Button */
.tasks-summary-toggle {
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.tasks-summary-toggle:hover {
  color: var(--brand);
  transform: scale(1.1);
}

.tasks-summary-toggle svg {
  width: 20px;
  height: 20px;
}

/* Tasks Summary Modal */
.tasks-summary-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.tasks-summary-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.tasks-summary-dialog {
  position: relative;
  width: 500px;
  max-width: 90vw;
  max-height: 80vh;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tasks-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.tasks-summary-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.tasks-summary-close-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  color: var(--danger);
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.tasks-summary-close-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.tasks-summary-content {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.tasks-summary-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 14px;
}

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

.tasks-summary-group-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tasks-summary-group-title {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  flex: 1;
}

.tasks-summary-chevrons {
  display: flex;
  gap: 2px;
}

.tasks-summary-chevron-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.tasks-summary-chevron-btn:hover:not(:disabled) {
  color: var(--text);
  background: var(--bg);
}

.tasks-summary-chevron-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.tasks-summary-chevron-btn svg {
  width: 14px;
  height: 14px;
}

.tasks-summary-bubbles {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.tasks-summary-goto-btn {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.tasks-summary-goto-btn:hover {
  color: var(--brand);
  opacity: 1;
  transform: translateX(2px);
}

/* Highlight effect when navigating to a task source */
.task-highlight {
  animation: taskHighlightPulse 2s ease-out;
}

@keyframes taskHighlightPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(44, 123, 229, 0.6);
  }
  20% {
    box-shadow: 0 0 0 8px rgba(44, 123, 229, 0.4);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(44, 123, 229, 0);
  }
}

.tasks-summary-bubble {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
  max-width: fit-content;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.tasks-summary-bubble:hover {
  filter: brightness(0.95);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.tasks-summary-bubble:active {
  transform: scale(0.95);
}

/* Reuse task bubble colors */
.tasks-summary-bubble.task-bubble-red {
  background: #fecaca;
  border: 2px solid #f87171;
  color: #991b1b;
}

.tasks-summary-bubble.task-bubble-yellow {
  background: #fde68a;
  border: 2px solid #fbbf24;
  color: #92400e;
}

.tasks-summary-bubble.task-bubble-green {
  background: #a7f3d0;
  border: 2px solid #34d399;
  color: #065f46;
}

/* Dark mode tasks summary */
[data-theme="dark"] .tasks-summary-dialog {
  background: var(--card);
}

[data-theme="dark"] .tasks-summary-header {
  border-bottom-color: #475569;
}

[data-theme="dark"] .tasks-summary-bubble.task-bubble-red {
  background: #7f1d1d;
  border-color: #f87171;
  color: #fecaca;
}

[data-theme="dark"] .tasks-summary-bubble.task-bubble-yellow {
  background: #78350f;
  border-color: #fbbf24;
  color: #fef08a;
}

[data-theme="dark"] .tasks-summary-bubble.task-bubble-green {
  background: #064e3b;
  border-color: #34d399;
  color: #a7f3d0;
}

/* Glass mode tasks summary */
body[data-style="glass"] .tasks-summary-dialog {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

body[data-style="glass"] .tasks-summary-header {
  background: rgba(255, 255, 255, 0.6);
}

body[data-theme="dark"][data-style="glass"] .tasks-summary-dialog {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

body[data-theme="dark"][data-style="glass"] .tasks-summary-header {
  background: rgba(30, 41, 59, 0.6);
}

body[data-style="glass"][data-glass-theme="sunset"] .tasks-summary-dialog {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
}

body[data-style="glass"][data-glass-theme="sunset"] .tasks-summary-header {
  background: rgba(255, 255, 255, 0.5);
}

body[data-theme="dark"][data-style="glass"][data-glass-theme="sunset"] .tasks-summary-dialog {
  background: rgba(30, 41, 59, 0.5);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
}

body[data-theme="dark"][data-style="glass"][data-glass-theme="sunset"] .tasks-summary-header {
  background: rgba(30, 41, 59, 0.5);
}

/* ============================================================
   EISENHOWER MATRIX STYLES
   ============================================================ */

/* Slide-out card container (like quick-access-card) */
.eisenhower-card {
  max-width: calc(100% - 32px);
  position: relative;
  display: flex;
  flex-direction: column;
}
.eisenhower-card[hidden] { display: none; }
.eisenhower-card:not(.active) {
  opacity: 0;
  height: 0;
  padding: 0 !important;
  margin: 0 auto !important;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
}
.eisenhower-card.active {
  opacity: 1;
  margin: 0 auto 12px auto !important;
  padding: var(--card-padding-top) 40px 20px 40px !important;
  transition: opacity 0.2s ease-in;
}

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

.eisenhower-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.eisenhower-header h3 {
  margin: 0;
  font-size: 24px;
}

.btn-delete-task-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(78, 173, 107, 0.8);
  color: #fff;
  border: none;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.btn-delete-task-drop.drag-hover {
  transform: scale(1.15);
  background: #22c55e;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.5);
  animation: delete-drop-pulse 0.8s ease-in-out infinite;
}

@keyframes delete-drop-pulse {
  0%, 100% { transform: scale(1.15); box-shadow: 0 0 12px rgba(34, 197, 94, 0.5); }
  50% { transform: scale(1.25); box-shadow: 0 0 20px rgba(34, 197, 94, 0.7); }
}

[data-theme="dark"] .btn-delete-task-drop {
  background: rgba(61, 148, 89, 0.8);
}

[data-theme="dark"] .btn-delete-task-drop.drag-hover {
  background: #16a34a;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

.btn-add-task-header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  color: #9ca3af;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-task-header:hover {
  color: var(--text);
  border-color: #9ca3af;
  transform: scale(1.05);
}

[data-theme="dark"] .btn-add-task-header {
  color: #6b7280;
  border-color: #4b5563;
}

[data-theme="dark"] .btn-add-task-header:hover {
  color: var(--text);
  border-color: #6b7280;
}

.eisenhower-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   IDEAS MODAL
   ============================================================ */
.ideas-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ideas-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.ideas-dialog {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 560px;
  max-width: 90vw;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ideas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
}

.ideas-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.ideas-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.ideas-close-btn:hover {
  color: var(--text);
}

/* Items list - shown above the editor */
.ideas-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 24px;
  margin-bottom: 16px;
  max-height: 35vh;
  overflow-y: auto;
}

.ideas-modal[hidden],
.ideas-items[hidden],
.ideas-editor-section[hidden] {
  display: none !important;
}

.ideas-item {
  position: relative;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  transition: all 0.15s ease;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .ideas-item {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
}

.ideas-item:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .ideas-item:hover {
  background: rgba(30, 41, 59, 0.95);
}

.ideas-item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

/* Editor section */
.ideas-editor-section {
  padding: 0 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ideas-title-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  background: var(--card);
  outline: none;
}

.ideas-title-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .ideas-title-input {
  border-color: #374151;
}

[data-theme="dark"] .ideas-title-input:focus {
  border-color: var(--brand);
}

.ideas-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: var(--bg);
  border-radius: 8px;
}

.ideas-editor {
  min-height: 180px;
  max-height: 40vh;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--card);
  outline: none;
}

.ideas-editor:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .ideas-editor {
  border-color: #374151;
}

[data-theme="dark"] .ideas-editor:focus {
  border-color: var(--brand);
}

.ideas-editor ul, .ideas-editor ol {
  margin: 0;
  padding-left: 20px;
}
.ideas-editor ul { list-style-type: disc; }
.ideas-editor ol { list-style-type: decimal; }
.ideas-editor ul ul { list-style-type: circle; margin-top: 2px; }
.ideas-editor ul ul ul { list-style-type: square; margin-top: 2px; }
.ideas-editor ul ul ul ul { list-style-type: disc; margin-top: 2px; }
.ideas-editor ol ol { list-style-type: lower-alpha; margin-top: 2px; }
.ideas-editor ol ol ol { list-style-type: lower-roman; margin-top: 2px; }
.ideas-editor ol ol ol ol { list-style-type: decimal; margin-top: 2px; }
.ideas-editor li { margin: 2px 0; }

.ideas-editor-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ideas-editor-actions-right {
  display: flex;
  gap: 8px;
}

.ideas-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
  transition: background 0.15s ease;
}

.ideas-delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Ideas toolbar button active state */
.ideas-toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
}

.ideas-toolbar-btn:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}

[data-theme="dark"] .ideas-toolbar-btn:hover {
  background: rgba(255,255,255,0.08);
}

.ideas-toolbar-btn.active {
  background: var(--brand);
  color: white;
}

/* View mode for reading a saved idea */
.ideas-view-section {
  padding: 0 24px 24px;
}

.ideas-view-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.ideas-view-content {
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 80px;
  max-height: 40vh;
  overflow-y: auto;
  margin-bottom: 16px;
}

[data-theme="dark"] .ideas-view-content {
  border-color: #374151;
}

.ideas-view-actions {
  display: flex;
  gap: 6px;
}

.ideas-view-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.ideas-view-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

[data-theme="dark"] .ideas-view-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ideas-view-icon-danger:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

/* Horizontal 4-card grid */
.eisenhower-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

/* Section headings (Important / Secondary) */
.eisenhower-section {
  margin-bottom: 24px;
}

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

.eisenhower-section-heading {
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin: 0 0 14px 4px;
}

/* Columns grid (the 4 Eisenhower cards) */
.eisenhower-columns-grid {
  display: flex;
  gap: 16px;
  overflow-x: auto;
}

/* Individual priority cards with colored backgrounds */
.eisenhower-priority-card {
  flex: 1;
  min-width: 200px;
  border-radius: 12px;
  padding: 16px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
}

.eisenhower-priority-card-blue {
  background: #c4d9fc;
}

.eisenhower-priority-card-yellow {
  background: #fce9a0;
}

.eisenhower-priority-card-orange {
  background: #fdddb3;
}

.eisenhower-priority-card-red {
  background: #fccece;
}

[data-theme="dark"] .eisenhower-priority-card-blue {
  background: #17305a;
}

[data-theme="dark"] .eisenhower-priority-card-yellow {
  background: #3d1c04;
}

[data-theme="dark"] .eisenhower-priority-card-orange {
  background: #3c1105;
}

[data-theme="dark"] .eisenhower-priority-card-red {
  background: #3f0808;
}

.eisenhower-card-header {
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 22px;
  text-align: center;
  color: var(--text);
}

.eisenhower-card-tasks {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100px;
  position: relative;
}

.eisenhower-card-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
  opacity: 0.6;
}

.eisenhower-task {
  position: relative;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.06),
    0 8px 30px rgba(0,0,0,0.04),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}
/* Glass shine */
.eisenhower-task::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 30% 60% at 10% 30%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.18) 40%, transparent 70%),
    radial-gradient(ellipse 85% 50% at 50% -10%, rgba(255,255,255,0.65) 0%, rgba(255,255,255,0.3) 35%, rgba(255,255,255,0.06) 60%, transparent 80%),
    linear-gradient(160deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.15) 25%, transparent 50%, rgba(255,255,255,0.02) 75%, rgba(255,255,255,0.08) 100%);
  pointer-events: none;
  z-index: 1;
}
/* Glass rim */
.eisenhower-task::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.4),
    inset 0 2px 4px rgba(255,255,255,0.55),
    inset 0 -2px 4px rgba(0,0,0,0.04),
    inset 2px 0 4px rgba(255,255,255,0.1),
    inset -2px 0 4px rgba(255,255,255,0.1);
  pointer-events: none;
  z-index: 2;
}
/* Elevate content above glass */
.eisenhower-task > * {
  position: relative;
  z-index: 3;
}

[data-theme="dark"] .eisenhower-task {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(148, 163, 184, 0.1);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.25),
    0 8px 30px rgba(0,0,0,0.15),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}
[data-theme="dark"] .eisenhower-task::before {
  background:
    radial-gradient(ellipse 30% 60% at 10% 30%, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.07) 40%, transparent 70%),
    radial-gradient(ellipse 85% 50% at 50% -10%, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.1) 35%, rgba(255,255,255,0.02) 60%, transparent 80%),
    linear-gradient(160deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 25%, transparent 50%, rgba(0,0,0,0.04) 75%, rgba(255,255,255,0.04) 100%);
}
[data-theme="dark"] .eisenhower-task::after {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.1),
    inset 0 2px 4px rgba(255,255,255,0.15),
    inset 0 -2px 4px rgba(0,0,0,0.18),
    inset 2px 0 4px rgba(255,255,255,0.04),
    inset -2px 0 4px rgba(255,255,255,0.04);
}

.eisenhower-task:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.08),
    0 10px 35px rgba(0,0,0,0.05),
    inset 0 1px 2px rgba(255,255,255,0.95),
    inset 0 -3px 8px rgba(0,0,0,0.03);
}

[data-theme="dark"] .eisenhower-task:hover {
  background: rgba(30, 41, 59, 0.95);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.3),
    0 10px 35px rgba(0,0,0,0.2),
    inset 0 1px 2px rgba(255,255,255,0.1),
    inset 0 -3px 8px rgba(0,0,0,0.12);
}

.eisenhower-task.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.eisenhower-task-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eisenhower-task-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.eisenhower-task-link-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.eisenhower-task-link-btn:hover {
  opacity: 1;
}

.eisenhower-task-link-btn svg {
  display: block;
}

.eisenhower-task-linked {
  opacity: 0.6;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.eisenhower-task-linked svg {
  display: block;
}

/* Task stopwatch (rightmost on each pill). While running, the elapsed time
   sits to the left of the icon. The small negative block margin keeps the
   20px button inside the pill's line box, so the pill never changes height.
   The running crystal (glass look) lives in glass-fx.css section 9b; the
   rule here is the plain fallback. */
.task-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-block: -4px;
  flex-shrink: 0;
}
.task-timer-time {
  display: none;
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--text);
}
.task-timer.is-running .task-timer-time { display: block; }
.task-timer-btn {
  position: relative;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s ease, background-color 0.15s ease, box-shadow 0.2s ease;
}
.task-timer-btn svg {
  display: block;
  width: 15px;
  height: 15px;
}
.task-timer-btn:hover { opacity: 1; }
/* Complete (circle check), left of the stopwatch: asks, then completes */
.task-complete-btn {
  position: relative;
  width: 20px;
  height: 20px;
  margin-block: -4px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s ease, color 0.15s ease, background-color 0.15s ease, box-shadow 0.2s ease;
}
.task-complete-btn svg {
  display: block;
  width: 16px;
  height: 16px;
}
.task-complete-btn:is(:hover, :focus-visible) {
  opacity: 1;
  color: var(--task-timer-live);
}
.task-complete-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.task-timer.is-running .task-timer-btn,
.task-timer-btn.is-running {
  opacity: 1;
  color: #fff;
  background: var(--task-timer-btn);
}

/* Pinned task backgrounds */
.eisenhower-task-pinned { border-color: transparent; }
.eisenhower-priority-card-blue .eisenhower-task-pinned { background: #dceafd; }
.eisenhower-priority-card-yellow .eisenhower-task-pinned { background: #fcf1c8; }
.eisenhower-priority-card-orange .eisenhower-task-pinned { background: #fee8d3; }
.eisenhower-priority-card-red .eisenhower-task-pinned { background: #fddede; }

[data-theme="dark"] .eisenhower-priority-card-blue .eisenhower-task-pinned { background: #243f6a; }
[data-theme="dark"] .eisenhower-priority-card-yellow .eisenhower-task-pinned { background: #4d2a0c; }
[data-theme="dark"] .eisenhower-priority-card-orange .eisenhower-task-pinned { background: #4e1c0e; }
[data-theme="dark"] .eisenhower-priority-card-red .eisenhower-task-pinned { background: #511212; }

/* SVG animated border */
.animated-border-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}

.animated-border-light {
  fill: none;
  stroke-linecap: round;
  opacity: 0;
  animation: glassRimShimmer var(--rim-glow-duration) cubic-bezier(0.4, 0, 0.2, 1) var(--rim-glow-delay) infinite;
}

@keyframes glassRimShimmer {
  /* Only the peak hold is shortened. These offsets preserve the original
     fade segment lengths after the cycle is reduced to 137/150 of its size. */
  0%, 100% { opacity: 0.04; }
  19.708029% { opacity: 0.7; }
  41.605839% { opacity: 1; }
  46.350365% { opacity: 0.95; }
  73.722628% { opacity: 0.28; }
}

/* Task Link Bubble */
.task-link-bubble {
  position: fixed;
  background: var(--card);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 8px 12px;
  z-index: 10000;
  white-space: nowrap;
}

.task-link-bubble-link {
  color: var(--brand);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.task-link-bubble-link:hover {
  text-decoration: underline;
}

[data-theme="dark"] .task-link-bubble {
  background: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.eisenhower-drop-indicator {
  height: 3px;
  background: var(--brand);
  border-radius: 2px;
  margin: 4px 0;
  box-shadow: 0 0 8px rgba(44, 123, 229, 0.5);
}

/* Mobile: stack vertically */
@media (max-width: 768px) {
  .eisenhower-columns-grid {
    flex-direction: column;
  }
  .eisenhower-priority-card {
    min-width: unset;
  }
}

/* ============================================================
   TASK EDITOR MODAL
   ============================================================ */

.task-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 10010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
}

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

.task-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.task-editor-dialog {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.task-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

[data-theme="dark"] .task-editor-header {
  border-bottom-color: #475569;
}

.task-editor-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.task-editor-close-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  color: var(--danger);
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.task-editor-close-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.task-editor-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.task-editor-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 0 0 532px;
  overflow-y: auto;
}

.task-editor-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* The Linked Project/Meeting row is hidden for tasks without one */
.task-editor-field[hidden] { display: none; }

.task-editor-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.task-editor-field input[type="text"] {
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.task-editor-field input[type="text"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}

[data-theme="dark"] .task-editor-field input[type="text"],
[data-theme="dark"] .task-editor-field input[type="url"] {
  border-color: #475569;
}

/* Task editor date + time inputs (one row: the date grows, the time keeps its width) */
.task-editor-field input[type="date"],
.task-editor-field input[type="time"] {
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  box-sizing: border-box;
}
.task-editor-field input[type="date"]:focus,
.task-editor-field input[type="time"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}
[data-theme="dark"] .task-editor-field input[type="date"],
[data-theme="dark"] .task-editor-field input[type="time"] {
  border-color: #475569;
  background: #1e293b;
  color-scheme: dark;
}
/* Date · start – end ×: the time pair wraps under the date when the dialog is narrow */
.task-editor-due-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.task-editor-due-row > input[type="date"] { flex: 1 1 150px; min-width: 0; }
.task-editor-time-wrap { flex: 0 1 auto; display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
/* 132px at the desktop's 14px; the phone frame's 16px fields grow with it so "PM" isn't cut
   (and give way on a line narrower than both) */
.task-editor-time-wrap input[type="time"] { flex: 0 1 9.45em; width: 9.45em; min-width: 0; }
.task-editor-end-wrap { display: flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0; }
.task-editor-end-wrap[hidden] { display: none; }
.task-editor-time-sep { color: var(--muted); padding: 0 1px; user-select: none; }
/* No time yet: the empty field reads quieter */
.task-editor-time-wrap input[type="time"].is-empty:not(:focus) { color: var(--muted); }
/* An end that isn't after the start (dropped on save) */
body .task-editor-field .task-editor-time-wrap input[type="time"][aria-invalid="true"],
body[data-style="glass"][data-theme] .task-editor-field .task-editor-time-wrap input[type="time"][aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent);
}
@media (forced-colors: active) {
  .task-editor-field .task-editor-time-wrap input[type="time"][aria-invalid="true"] { border: 2px solid Mark; }
}
.task-editor-time-clear {
  display: grid; place-items: center;
  width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--muted);
  cursor: pointer;
}
.task-editor-time-clear[hidden] { display: none; }
.task-editor-time-clear:hover { background: rgba(148, 163, 184, 0.22); color: var(--text); }

.task-editor-link-type-select {
  padding: 8px 22px 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  width: 100%;
}
[data-theme="dark"] .task-editor-link-type-select {
  border-color: #475569;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
#task-editor-link-url-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}
#task-editor-link-url-wrap input {
  flex: 1;
}
/* Task links & files list */
.task-editor-links-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.task-editor-link-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.task-editor-link-row .task-subtask-title-wrap {
  flex: 1;
}
.task-editor-link-row .task-subtask-title-input.locked {
  color: var(--brand);
  font-weight: 500;
  cursor: pointer;
  padding-right: 56px;
}
/* Edit + delete buttons inside the locked link row */
.task-editor-link-inline-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.task-editor-link-inline-btn:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}
[data-theme="dark"] .task-editor-link-inline-btn:hover {
  background: rgba(255,255,255,0.1);
}
.task-editor-link-edit-btn {
  right: 28px;
}
.task-editor-link-delete-btn {
  right: 4px;
}
.task-editor-link-type-choice {
  display: flex;
  gap: 8px;
}
.task-editor-type-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.task-editor-type-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.task-editor-type-btn-cancel {
  flex: 0 0 auto;
  width: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-editor-type-btn-cancel:hover {
  color: var(--text);
}
[data-theme="dark"] .task-editor-type-btn {
  border-color: #475569;
}
.task-editor-link-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.task-editor-link-icon-btn:hover {
  color: var(--text);
  background: rgba(0,0,0,0.06);
}
[data-theme="dark"] .task-editor-link-icon-btn:hover {
  background: rgba(255,255,255,0.1);
}

.task-editor-link-row .task-editor-file-row {
  flex: 1;
}
.task-editor-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.task-editor-file-title {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.task-editor-file-title:focus {
  border-color: var(--brand);
}
[data-theme="dark"] .task-editor-file-title {
  border-color: #475569;
}
.task-editor-file-btn {
  padding: 8px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.task-editor-file-btn:hover {
  border-color: var(--brand);
}
[data-theme="dark"] .task-editor-file-btn {
  border-color: #475569;
}
.task-editor-file-name {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.task-editor-colors {
  display: flex;
  gap: 10px;
}

.task-editor-color-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.task-editor-color-btn.active {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px var(--brand);
}

/* Task editor: category chips (click the selected one again to clear) */
.task-editor-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.task-category-chip {
  --chip-color: var(--task-cat-none);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--glass-divider, #e5e7eb);
  border-radius: 999px;
  background: var(--glass-field, #f8fafc);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.task-category-chip:hover { background: var(--glass-hover, #eef2f7); }
.task-category-chip.active {
  border-color: var(--chip-color);
  background: color-mix(in srgb, var(--chip-color) 18%, var(--glass-field, #fff));
  box-shadow: 0 0 0 1.5px var(--chip-color);
  font-weight: 600;
}
.task-category-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--chip-color);
  flex-shrink: 0;
}
.task-editor-categories-empty {
  font-size: 13px;
  color: var(--muted);
}

.task-editor-primary-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  user-select: none;
}

.task-editor-primary-label input[type="checkbox"] {
  display: none;
}

.task-editor-primary-box {
  width: 18px;
  height: 18px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.task-editor-primary-label:hover .task-editor-primary-box {
  border-color: var(--brand);
}

.task-editor-primary-label input:checked + .task-editor-primary-box {
  background: var(--brand);
  border-color: var(--brand);
}

.task-editor-primary-label input:checked + .task-editor-primary-box::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
}

[data-theme="dark"] .task-editor-primary-box {
  border-color: #4b5563;
}

/* "Add to Google Calendar" under the due date (google-calendar.js decides if it shows) */
.task-editor-gcal-label { display: flex; width: fit-content; }
.task-editor-gcal-label[hidden] { display: none; }
.task-editor-gcal-hint { display: none; font-weight: 400; color: var(--muted); }
.task-editor-gcal-label.is-nodate .task-editor-gcal-hint { display: inline; }
.task-editor-gcal-label.is-nodate input:checked + .task-editor-primary-box { opacity: 0.55; }

.task-editor-item-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

[data-theme="dark"] .task-editor-item-selector {
  border-color: #475569;
}

.task-editor-item-text {
  flex: 1;
  font-size: 14px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-editor-item-text.has-item {
  color: var(--text);
}

.task-editor-item-btn {
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.task-editor-item-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

[data-theme="dark"] .task-editor-item-btn {
  border-color: #475569;
}

.task-editor-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  gap: 12px;
}

[data-theme="dark"] .task-editor-actions {
  border-top-color: #475569;
}

.task-editor-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--muted);
  opacity: 0.7;
  transition: opacity 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.task-editor-delete-btn:hover {
  opacity: 1;
  color: var(--danger);
}

.task-editor-delete-btn[hidden] {
  display: none;
}

.task-editor-actions-right {
  display: flex;
  gap: 12px;
  margin-left: auto;
}

/* Task Editor Description Panel */
.task-editor-description {
  flex: 1;
  padding: 24px;
  border-left: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

[data-theme="dark"] .task-editor-description {
  border-left-color: #475569;
}

.task-editor-description > label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.task-desc-view {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: var(--bg);
}

[data-theme="dark"] .task-desc-view {
  background: #1e293b;
  border-color: #475569;
}

.task-desc-view-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.task-desc-view-content:empty + .task-desc-view-empty {
  display: block;
}

.task-desc-view-empty {
  display: none;
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}

.task-desc-view-content ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.task-desc-view-content ul ul {
  list-style-type: circle;
  margin-top: 2px;
}

.task-desc-view-content ol {
  margin: 0;
  padding-left: 20px;
  list-style-type: decimal;
}

.task-desc-view-content li {
  margin: 2px 0;
}

.task-desc-edit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  align-self: flex-start;
  flex-shrink: 0;
}

.task-desc-edit-btn[hidden] {
  display: none;
}

.task-desc-edit-btn:hover {
  color: var(--brand);
  border-color: var(--brand);
}

[data-theme="dark"] .task-desc-edit-btn {
  border-color: #475569;
}

[data-theme="dark"] .task-desc-edit-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* Description editor wrap */
.task-desc-editor-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.task-desc-editor-wrap[hidden] {
  display: none;
}

.task-desc-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  margin-bottom: 8px;
  background: var(--bg);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  flex-shrink: 0;
}

[data-theme="dark"] .task-desc-toolbar {
  background: #1e293b;
  border-color: #475569;
}

.task-desc-toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
}

.task-desc-toolbar-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.task-desc-toolbar-btn.active {
  background: var(--brand);
  color: white;
}

[data-theme="dark"] .task-desc-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.task-desc-toolbar-divider {
  width: 1px;
  height: 20px;
  background: #e5e7eb;
  margin: 0 6px;
}

[data-theme="dark"] .task-desc-toolbar-divider {
  background: #475569;
}

.task-desc-editor {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.task-desc-editor:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}

.task-desc-editor:empty::before {
  content: 'Describe this task...';
  color: var(--muted);
  font-style: italic;
}
/* The meetings editor borrows the task editor's class */
#meetings-inline-desc-editor:empty::before {
  content: 'Meeting notes\2026  type / for blocks';
}

[data-theme="dark"] .task-desc-editor {
  background: #1e293b;
  border-color: #475569;
}

[data-theme="dark"] .task-desc-editor:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.task-desc-editor ul,
.task-desc-editor ol {
  margin: 0;
  padding-left: 20px;
}

.task-desc-editor ul {
  list-style-type: disc;
}

.task-desc-editor ol {
  list-style-type: decimal;
}

.task-desc-editor ul ul {
  list-style-type: circle;
  margin-top: 2px;
}
.task-desc-editor ul ul ul {
  list-style-type: square;
  margin-top: 2px;
}
.task-desc-editor ul ul ul ul {
  list-style-type: disc;
  margin-top: 2px;
}
.task-desc-editor ol ol {
  list-style-type: lower-alpha;
  margin-top: 2px;
}
.task-desc-editor ol ol ol {
  list-style-type: lower-roman;
  margin-top: 2px;
}
.task-desc-editor ol ol ol ol {
  list-style-type: decimal;
  margin-top: 2px;
}
.task-desc-editor li {
  margin: 2px 0;
}

.task-desc-editor-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 8px;
  flex-shrink: 0;
}

.task-desc-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.task-desc-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

[data-theme="dark"] .task-desc-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.task-desc-save-btn:hover {
  color: var(--accent);
}

/* Heading styles for description editor */
.task-desc-editor h1,
.task-desc-editor h2,
.task-desc-editor h3,
.task-desc-editor h4,
.task-desc-editor h5,
.task-desc-editor h6 {
  margin: 4px 0;
  font-weight: 600;
  line-height: 1.3;
}
.task-desc-editor h1 { font-size: 1.5em; }
.task-desc-editor h2 { font-size: 1.3em; }
.task-desc-editor h3 { font-size: 1.15em; }
.task-desc-editor h4 { font-size: 1em; }
.task-desc-editor h5 { font-size: 0.9em; }
.task-desc-editor h6 { font-size: 0.85em; color: var(--muted); }

/* Heading styles for description view */
.task-desc-view-content h1,
.task-desc-view-content h2,
.task-desc-view-content h3,
.task-desc-view-content h4,
.task-desc-view-content h5,
.task-desc-view-content h6 {
  margin: 4px 0;
  font-weight: 600;
  line-height: 1.3;
}
.task-desc-view-content h1 { font-size: 1.5em; }
.task-desc-view-content h2 { font-size: 1.3em; }
.task-desc-view-content h3 { font-size: 1.15em; }
.task-desc-view-content h4 { font-size: 1em; }
.task-desc-view-content h5 { font-size: 0.9em; }
.task-desc-view-content h6 { font-size: 0.85em; color: var(--muted); }

/* Responsive: stack on narrow screens. The dialog body scrolls as one column,
   and while the description is being edited it gets a real writing area
   (the whole visible body; the old fixed 300px left the editor a sliver) */
@media (max-width: 700px) {
  .task-editor-body {
    flex-direction: column;
    overflow-y: auto;
  }
  .task-editor-content {
    flex: 0 0 auto;
    overflow: visible;
  }
  .task-editor-description {
    flex: 0 0 auto;
    border-left: none;
    border-top: 1px solid #e5e7eb;
  }
  .task-editor-description:has(> .task-desc-editor-wrap:not([hidden])) {
    height: 100%;
    min-height: 320px;
  }
  [data-theme="dark"] .task-editor-description {
    border-left: none;
    border-top-color: #475569;
  }
}

/* ============================================================
   SUBTASKS (within task editor)
   ============================================================ */

.task-subtasks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-subtask-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-subtask-title-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
#task-subtasks-list .task-subtask-title-wrap { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
#task-subtasks-list .task-subtask-title-wrap:has(.task-subtask-title-input:not(.locked)) { row-gap: 6px; }
#task-subtasks-list .task-subtask-title-input { min-width: 0; grid-area: 1 / 1; padding-inline-start: 14px; }
#task-subtasks-list .task-subtask-title-input:not(.locked) { padding-inline-end: 38px; }
#task-subtasks-list .task-subtask-title-wrap:has(.task-subtask-date-hint:not(:empty)) .task-subtask-title-input.locked { padding-block: 6px 2px; }
.task-subtask-date-hint { grid-area: 2 / 1; padding: 0 15px 4px; font-size: 11px; line-height: 1.3; color: var(--muted); overflow-wrap: anywhere; }
.task-subtask-date-hint:empty { display: none; }
#task-subtasks-list .task-subtask-confirm-btn { position: static; grid-area: 1 / 1; align-self: center; justify-self: end; margin-inline-end: 6px; z-index: 1; }
#task-subtasks-list .task-timer { margin-block: 0; }
#task-subtasks-list .task-subtask-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; }
.task-subtask-grip { display: grid; place-items: center; width: 24px; height: 32px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: grab; touch-action: none; }
.task-subtask-grip:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
#task-subtasks-list.is-sorting { cursor: grabbing; user-select: none; }
#task-subtasks-list .is-dragging { opacity: 0.65; }
#task-subtasks-list .is-dragging .task-subtask-grip { cursor: grabbing; }
html[data-shell="mobile"] #task-subtasks-list .task-subtask-row { grid-template-columns: 28px minmax(0, 1fr); }
html[data-shell="mobile"] #task-subtasks-list .task-subtask-grip { width: 28px; height: 44px; grid-row: 1 / span 2; }
html[data-shell="mobile"] #task-subtasks-list .task-subtask-title-wrap { grid-column: 2; }
html[data-shell="mobile"] #task-subtasks-list .task-subtask-actions { grid-column: 2; justify-self: end; }
html[data-shell="mobile"] #task-subtasks-list .task-timer-btn { width: 40px; height: 40px; }

.task-subtask-title-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.task-editor-field .task-subtask-title-input.locked {
  background: var(--card);
  cursor: pointer;
}

.task-subtask-title-input:not(.locked) {
  padding-right: 32px;
}

.task-subtask-title-input:not(.locked):focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}

.task-subtask-title-input.locked:focus {
  outline: none;
}

[data-theme="dark"] .task-subtask-title-input {
  border-color: #475569;
}

.task-subtask-confirm-btn {
  position: absolute;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.task-subtask-confirm-btn:hover {
  background: rgba(78, 173, 107, 0.1);
}

.task-subtask-confirm-btn[hidden] {
  display: none;
}

/* Completed subtask styling */
.task-subtask-title-input.subtask-completed,
.task-editor-field .task-subtask-title-input.subtask-completed,
[data-theme="dark"] .task-subtask-title-input.subtask-completed {
  font-weight: 700;
  color: var(--accent);
}

.task-subtask-complete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.task-subtask-complete-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--accent);
}

.task-subtask-complete-btn.is-completed {
  color: var(--accent);
  font-weight: 700;
}

.task-subtask-complete-btn.is-completed:hover {
  opacity: 0.8;
}

[data-theme="dark"] .task-subtask-complete-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.task-subtask-desc-btn,
.task-subtask-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.task-subtask-desc-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--brand);
}

.task-subtask-desc-btn.has-content {
  color: var(--brand);
  opacity: 0.8;
}

.task-subtask-desc-btn.has-content:hover {
  opacity: 1;
}

[data-theme="dark"] .task-subtask-desc-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.task-subtask-delete-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--danger);
}

[data-theme="dark"] .task-subtask-delete-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Subtask actions wrapper */
.task-subtask-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* 3-dot menu */
.task-subtask-menu-wrap {
  position: relative;
}
.task-subtask-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.task-subtask-menu-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}
.task-subtask-menu-btn.has-desc {
  color: var(--brand);
}
[data-theme="dark"] .task-subtask-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.task-subtask-menu-dropdown {
  position: fixed;
  z-index: 10020;
  min-width: 160px;
  background: var(--card, #ffffff);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 4px;
}
[data-theme="dark"] .task-subtask-menu-dropdown {
  background: var(--card, #1e293b);
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}
.task-subtask-menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  transition: background 0.12s;
}
.task-subtask-menu-item:hover {
  background: rgba(0,0,0,0.05);
}
[data-theme="dark"] .task-subtask-menu-item:hover {
  background: rgba(255,255,255,0.08);
}
.task-subtask-menu-item-danger {
  color: var(--danger);
}
.task-subtask-menu-item-danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

/* Subtask date picker */
.task-subtask-date-wrap {
  position: relative;
}
.task-subtask-date-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.task-subtask-date-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}
.task-subtask-date-btn.has-date {
  color: var(--brand);
}
[data-theme="dark"] .task-subtask-date-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.task-subtask-date-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.task-subtasks-pct {
  font-size: 12px;
  font-weight: 700;
  color: #16a34a;
  margin-left: 6px;
}
[data-theme="dark"] .task-subtasks-pct {
  color: #4ade80;
}

.task-subtasks-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin-top: 4px;
  border: 1.5px dashed #d1d5db;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.task-subtasks-add-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

[data-theme="dark"] .task-subtasks-add-btn {
  border-color: #475569;
}

[data-theme="dark"] .task-subtasks-add-btn:hover {
  border-color: var(--brand);
}

/* ---- Subtask actions row (+ and save template side by side) ---- */
.task-subtasks-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---- Save template icon button (minimalist, no box) ---- */
.task-subtasks-template-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin-top: 4px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease;
  opacity: 0.6;
}

.task-subtasks-template-btn:hover {
  color: var(--brand);
  opacity: 1;
}

/* ---- Subtask template name modal ---- */
.subtask-template-name-modal {
  position: fixed;
  inset: 0;
  z-index: 10030;
  display: flex;
  align-items: center;
  justify-content: center;
}

.subtask-template-name-modal[hidden] {
  display: none;
}

.subtask-template-name-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.subtask-template-name-dialog {
  position: relative;
  background: var(--bg);
  border-radius: 14px;
  padding: 24px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.subtask-template-name-dialog h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.subtask-template-name-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--muted);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.subtask-template-name-input:focus {
  border-color: var(--brand);
}

.subtask-template-name-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

[data-theme="dark"] .subtask-template-name-dialog {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .subtask-template-name-input {
  border-color: #475569;
}

/* ---- Subtask template picker (bubble column) ---- */
.subtask-template-picker {
  position: fixed;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10020;
  pointer-events: none;
}

.subtask-template-picker.open {
  pointer-events: auto;
}

.subtask-template-picker.open .subtask-template-bubble-row {
  animation: linkBubbleIn 0.3s ease forwards;
}

.subtask-template-picker.closing .subtask-template-bubble-row {
  animation: linkBubbleOut 0.25s ease forwards;
}

.subtask-template-bubble-row {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transform: translateX(-20px) scale(0.5);
}

.subtask-template-bubble {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  background: #e8edf4;
  border: none;
  cursor: pointer;
  transition: filter 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  max-width: fit-content;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.subtask-template-bubble:hover {
  filter: brightness(0.95);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .subtask-template-bubble {
  background: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .subtask-template-bubble:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.subtask-template-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.15);
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, background 0.2s;
  flex-shrink: 0;
}

.subtask-template-delete-btn:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

[data-theme="dark"] .subtask-template-delete-btn {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .subtask-template-delete-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* ---- Subtask bubble (glass-like row when locked) ---- */
.task-subtask-row.subtask-bubble {
  background: #e8edf4;
  border: 1.5px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  padding: 4px 8px;
  position: relative;
  z-index: 0;
  isolation: isolate;
  transition: background 0.3s ease, box-shadow 0.4s ease, border-color 0.3s ease;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 2px rgba(255,255,255,0.7),
    inset 0 -1px 4px rgba(0,0,0,0.02);
}

/* Glass shine overlay */
.task-subtask-row.subtask-bubble::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 25% 70% at 12% 30%, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.15) 40%, transparent 70%),
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0.2) 35%, transparent 80%),
    linear-gradient(160deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.1) 25%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* Glass rim */
.task-subtask-row.subtask-bubble::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.3),
    inset 0 1px 3px rgba(255,255,255,0.45),
    inset 0 -1px 3px rgba(0,0,0,0.03);
  pointer-events: none;
  z-index: -1;
}

/* Row with an open 3-dot menu must rise above sibling rows —
   .subtask-bubble creates a stacking context (isolation + z-index: 0),
   so the dropdown's z-index can't escape it on its own */
.task-subtask-row.menu-open {
  position: relative;
  z-index: 100;
}

/* Locked input inside bubble is transparent */
.task-subtask-row.subtask-bubble .task-subtask-title-input.locked {
  background: transparent;
  border-color: transparent;
  font-weight: 500;
}

/* Completed bubble — green glow */
.task-subtask-row.subtask-bubble-completed {
  background: #d1fae5;
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow:
    0 0 10px 2px rgba(34, 197, 94, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.06),
    inset 0 1px 2px rgba(255,255,255,0.7);
}

.task-subtask-row.subtask-bubble-completed .task-subtask-title-input.locked {
  color: #166534;
  font-weight: 700;
}

/* Important bubble — orange glow */
.task-subtask-row.subtask-bubble-important {
  background: #ffedd5;
  border-color: rgba(249, 115, 22, 0.35);
  box-shadow:
    0 0 10px 2px rgba(249, 115, 22, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.06),
    inset 0 1px 2px rgba(255,255,255,0.7);
}

.task-subtask-row.subtask-bubble-important .task-subtask-title-input.locked {
  color: #9a3412;
  font-weight: 600;
}

/* Important button */
.task-subtask-important-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.task-subtask-important-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #f97316;
}

.task-subtask-important-btn.is-important {
  color: #f97316;
}

.task-subtask-important-btn.is-important:hover {
  opacity: 0.8;
}

/* ---- Dark mode subtask bubbles ---- */
[data-theme="dark"] .task-subtask-row.subtask-bubble {
  background: #293548;
  border-color: rgba(100, 116, 139, 0.4);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 2px rgba(255,255,255,0.08),
    inset 0 -1px 4px rgba(0,0,0,0.1);
}

[data-theme="dark"] .task-subtask-row.subtask-bubble::before {
  background:
    radial-gradient(ellipse 25% 70% at 12% 30%, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.03) 40%, transparent 70%),
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.04) 35%, transparent 80%);
}

[data-theme="dark"] .task-subtask-row.subtask-bubble::after {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.06),
    inset 0 1px 3px rgba(255,255,255,0.08),
    inset 0 -1px 3px rgba(0,0,0,0.1);
}

[data-theme="dark"] .task-subtask-row.subtask-bubble-completed {
  background: #1a3a2a;
  border-color: rgba(34, 197, 94, 0.3);
  box-shadow:
    0 0 10px 2px rgba(34, 197, 94, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px rgba(255,255,255,0.06);
}

[data-theme="dark"] .task-subtask-row.subtask-bubble-completed .task-subtask-title-input.locked {
  color: #4ade80;
}

[data-theme="dark"] .task-subtask-row.subtask-bubble-important {
  background: #3a2a1a;
  border-color: rgba(249, 115, 22, 0.3);
  box-shadow:
    0 0 10px 2px rgba(249, 115, 22, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px rgba(255,255,255,0.06);
}

[data-theme="dark"] .task-subtask-row.subtask-bubble-important .task-subtask-title-input.locked {
  color: #fb923c;
}

[data-theme="dark"] .task-subtask-important-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Subtask description modal */
.subtask-desc-modal {
  position: fixed;
  inset: 0;
  z-index: 10011;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.subtask-desc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.subtask-desc-dialog {
  position: relative;
  width: 560px;
  max-width: 90vw;
  max-height: 80vh;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.subtask-desc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

[data-theme="dark"] .subtask-desc-header {
  border-bottom-color: #475569;
}

.subtask-desc-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.subtask-desc-close-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  color: var(--danger);
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.subtask-desc-close-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.subtask-desc-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.subtask-desc-body .task-desc-toolbar {
  margin-bottom: 8px;
}

.subtask-desc-body .task-desc-editor {
  min-height: 180px;
  flex: 1;
}

.subtask-desc-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
}

[data-theme="dark"] .subtask-desc-actions {
  border-top-color: #475569;
}

/* Delete button sits left, danger-colored */
.subtask-desc-delete-btn {
  margin-right: auto;
  color: #dc2626;
}
.subtask-desc-delete-btn:hover {
  background: rgba(220, 38, 38, 0.08);
}
[data-theme="dark"] .subtask-desc-delete-btn {
  color: #f87171;
}
[data-theme="dark"] .subtask-desc-delete-btn:hover {
  background: rgba(248, 113, 113, 0.12);
}

/* Reuse toolbar button styles for subtask modal */
.subtask-toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
}

.subtask-toolbar-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.subtask-toolbar-btn.active {
  background: var(--brand);
  color: white;
}

[data-theme="dark"] .subtask-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ============================================================
   ITEM TASKS MODAL (shows tasks linked to an item)
   ============================================================ */

.item-tasks-modal {
  position: fixed;
  inset: 0;
  z-index: 2001;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.item-tasks-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.item-tasks-dialog {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  width: 450px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.item-tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

[data-theme="dark"] .item-tasks-header {
  border-bottom-color: #475569;
}

.item-tasks-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.item-tasks-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  line-height: 1;
}

.item-tasks-close-btn:hover {
  color: var(--text);
}

.item-tasks-content {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.item-tasks-pills {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.item-tasks-empty {
  text-align: center;
  color: var(--muted);
  padding: 20px;
  font-size: 14px;
}

.item-task-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.item-task-pill:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.item-task-pill-title {
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-task-pill-color {
  font-size: 11px;
  opacity: 0.7;
  margin-left: 12px;
  white-space: nowrap;
}

.item-tasks-actions {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
}

[data-theme="dark"] .item-tasks-actions {
  border-top-color: #475569;
}

/* ============================================================
   ITEM SELECTOR MODAL
   ============================================================ */

.item-selector-modal {
  position: fixed;
  inset: 0;
  z-index: 10011;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.item-selector-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.item-selector-dialog {
  position: relative;
  width: 500px;
  max-width: 90vw;
  max-height: 80vh;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.item-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

[data-theme="dark"] .item-selector-header {
  border-bottom-color: #475569;
}

.item-selector-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.item-selector-close-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  color: var(--danger);
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.item-selector-close-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.item-selector-search {
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
}

[data-theme="dark"] .item-selector-search {
  border-bottom-color: #475569;
}

.item-selector-search input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.item-selector-search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}

[data-theme="dark"] .item-selector-search input {
  border-color: #475569;
}

.item-selector-categories {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.item-selector-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 14px;
}

.item-selector-category {
  margin-bottom: 20px;
}

.item-selector-category:last-child {
  margin-bottom: 0;
}

.item-selector-category-title {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

[data-theme="dark"] .item-selector-category-title {
  border-bottom-color: #475569;
}

.item-selector-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-selector-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.item-selector-item:hover {
  background: var(--bg);
}

.item-selector-item-title {
  font-size: 14px;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-selector-item-breadcrumb {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
  margin-left: 12px;
}

.item-selector-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-start;
}

[data-theme="dark"] .item-selector-footer {
  border-top-color: #475569;
}

/* ============================================================
   ITEM TASK PICKER MODAL (select existing task to link to item)
   ============================================================ */

.item-task-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 10012;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-task-picker-modal[hidden] {
  display: none;
}

.item-task-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.item-task-picker-dialog {
  position: relative;
  width: 520px;
  max-width: 90vw;
  max-height: 80vh;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.item-task-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

[data-theme="dark"] .item-task-picker-header {
  border-bottom-color: #475569;
}

.item-task-picker-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.item-task-picker-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  line-height: 1;
}

.item-task-picker-close-btn:hover {
  color: var(--text);
}

.item-task-picker-search {
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
}

[data-theme="dark"] .item-task-picker-search {
  border-bottom-color: #475569;
}

.item-task-picker-search input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.item-task-picker-search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
}

[data-theme="dark"] .item-task-picker-search input {
  border-color: #475569;
}

/* Task pills grouped in per-color columns (mirrors @ mention dropdown) */
.item-task-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
}

.item-task-picker-empty {
  width: 100%;
  text-align: center;
  color: var(--muted);
  padding: 24px 0;
  font-size: 14px;
}

/* ============================================================
   TASK EDITOR - LINKED ITEM MINIS
   ============================================================ */

.task-editor-linked-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.task-linked-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid #e5e7eb;
  cursor: pointer;
  font-size: 12px;
  min-width: 0;
  transition: filter 0.12s ease;
}

.task-linked-mini:hover {
  filter: brightness(0.95);
}

[data-theme="dark"] .task-linked-mini {
  border-color: #475569;
}

[data-theme="dark"] .task-linked-mini:hover {
  filter: brightness(1.15);
}

.task-linked-mini-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.task-linked-mini-link {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.task-linked-mini .days-badge {
  min-width: 0;
  font-size: 10px;
  padding: 3px 8px;
  flex-shrink: 0;
}

.task-linked-mini-copy {
  display: flex;
  align-items: center;
  color: var(--muted);
  flex-shrink: 0;
}

.task-linked-mini-icon-visual {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.task-linked-mini-icon-visual img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 5px;
}

.task-linked-mini-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}

.task-linked-mini-remove:hover {
  color: var(--danger);
}

.task-linked-mini-missing {
  opacity: 0.6;
  font-style: italic;
  cursor: default;
}

/* ============================================================
   MEETINGS MODAL
   ============================================================ */
.meetings-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.meetings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.meetings-dialog {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 95vw;
  height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.meetings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
}

.meetings-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.meetings-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.meetings-close-btn:hover {
  color: var(--text);
}

.meetings-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.meetings-sidebar {
  width: 30%;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0 24px 16px;
  overflow-y: auto;
  border-right: 1px solid #e5e7eb;
}

[data-theme="dark"] .meetings-sidebar {
  border-right-color: #374151;
}

.meetings-column {
  min-width: 0;
}

.meetings-column-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}

[data-theme="dark"] .meetings-column-title {
  border-bottom-color: #374151;
}

.meetings-item {
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-bottom: 6px;
  background: rgba(0,0,0,0.02);
}

[data-theme="dark"] .meetings-item {
  background: rgba(255,255,255,0.04);
}

.meetings-item:hover {
  background: rgba(0,0,0,0.06);
}

[data-theme="dark"] .meetings-item:hover {
  background: rgba(255,255,255,0.08);
}

.meetings-item.active {
  background: rgba(44, 123, 229, 0.08);
}

[data-theme="dark"] .meetings-item.active {
  background: rgba(59, 130, 246, 0.12);
}

.meetings-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.meetings-empty {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  padding: 8px 0;
}

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

.meetings-add-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(78, 173, 107, 0.8);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.meetings-add-circle:hover {
  background: #22c55e;
  transform: scale(1.1);
}

[data-theme="dark"] .meetings-add-circle {
  background: rgba(61, 148, 89, 0.8);
}

[data-theme="dark"] .meetings-add-circle:hover {
  background: #16a34a;
}

/* Meeting Editor Modal */
.meeting-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.meeting-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.meeting-editor-dialog {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 560px;
  max-width: 90vw;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.meeting-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
}

.meeting-editor-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.meeting-editor-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.meeting-editor-close-btn:hover {
  color: var(--text);
}

.meeting-editor-body {
  padding: 0 24px 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.meeting-editor-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.meeting-editor-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.meeting-editor-field input,
.meeting-editor-field select {
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s ease;
}

.meeting-editor-field input:focus,
.meeting-editor-field select:focus {
  outline: none;
  border-color: var(--brand);
}

[data-theme="dark"] .meeting-editor-field input,
[data-theme="dark"] .meeting-editor-field select {
  background: #1e293b;
  border-color: #475569;
}

/* Meeting editor top row: name (2/3) + type (1/6) + date (1/6) */
.meeting-editor-top-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.meeting-editor-recurrence-row {
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
}
.meeting-editor-recurrence-row .meeting-editor-field {
  flex: 1;
}

.meeting-editor-description {
  margin-top: 16px;
}

.meeting-editor-description-expanded {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.meeting-editor-description-expanded .task-desc-editor-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.meeting-editor-description-expanded .task-desc-editor {
  flex: 1;
  min-height: 200px;
}

.meeting-editor-description > label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

/* Meeting links section */
.meeting-links-section {
  margin-top: 10px;
}

.meeting-files-section {
  margin-top: 10px;
}
.meeting-files-section > label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}
.meeting-file-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.meeting-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: var(--bg);
}
[data-theme="dark"] .meeting-file-row {
  border-color: #475569;
}
.meeting-file-name {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meeting-file-open {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}
.meeting-file-open:hover {
  color: var(--brand);
  background: rgba(0,0,0,0.05);
}
[data-theme="dark"] .meeting-file-open:hover {
  background: rgba(255,255,255,0.08);
}
.meeting-file-add-row {
  margin-top: 4px;
}

.meeting-links-section > label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.meeting-link-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.meeting-link-row input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}

.meeting-link-row input:focus {
  outline: none;
  border-color: var(--brand);
}

[data-theme="dark"] .meeting-link-row input {
  background: #1e293b;
  border-color: #475569;
}

.meeting-link-remove {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.meeting-link-remove:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

.meeting-add-link-btn {
  padding: 6px 12px;
  border: 1px dashed #d1d5db;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 4px;
}

.meeting-add-link-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

[data-theme="dark"] .meeting-add-link-btn {
  border-color: #4b5563;
}

.meeting-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
}

[data-theme="dark"] .meeting-editor-actions {
  border-top-color: #374151;
}

.meeting-editor-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.meeting-editor-delete-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

.meeting-editor-actions-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* Meeting view - card within card */
.meetings-view-section {
  flex: 1;
  padding: 20px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

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

.meetings-view-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.meetings-view-type {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.meetings-view-content {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  padding: 12px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  min-height: 40px;
  margin-bottom: 12px;
  /* Long notes scroll inside the box: the Edit / Export / Delete row stays
     below it instead of being painted over */
  flex: 0 1 auto;
  overflow-y: auto;
}

[data-theme="dark"] .meetings-view-content {
  background: rgba(0, 0, 0, 0.15);
}

.meetings-view-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.meetings-view-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(44, 123, 229, 0.08);
  color: var(--brand);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease;
}

.meetings-view-link:hover {
  background: rgba(44, 123, 229, 0.15);
}

.meetings-view-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.meetings-view-actions {
  display: flex;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin-top: 4px;
}

[data-theme="dark"] .meetings-view-actions {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.meetings-view-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.meetings-view-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

[data-theme="dark"] .meetings-view-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.meetings-view-icon-danger:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

.meetings-edit-actions {
  justify-content: space-between;
}

.meetings-edit-actions-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.meetings-view-section .meeting-editor-description {
  margin-top: 16px;
}

.meetings-view-section .meeting-links-section {
  margin-top: 16px;
}

.meetings-view-section .task-desc-editor-wrap {
  display: flex;
  flex-direction: column;
}

.meetings-view-section .task-desc-editor {
  min-height: 120px;
}

/* Phones: the meeting list sits above the open meeting instead of a 200px
   column beside it, so the form and the description editor get the full
   width. While a meeting is open the list is a short scrolling strip */
@media (max-width: 600px) {
  .meetings-body {
    flex-direction: column;
  }
  .meetings-sidebar {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 16px 12px;
    border-right: none;
  }
  .meetings-body:has(> .meetings-view-section:not([hidden])) > .meetings-sidebar {
    flex: 0 0 auto;
    max-height: 26vh;
    border-bottom: 1px solid #e5e7eb;
  }
  [data-theme="dark"] .meetings-body:has(> .meetings-view-section:not([hidden])) > .meetings-sidebar {
    border-bottom-color: #374151;
  }
  .meetings-view-section {
    min-height: 0;
    padding: 16px;
  }
  /* Name on its own row, type + date share the next one */
  .meeting-editor-top-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .meeting-editor-top-row > .meeting-editor-name-col {
    grid-column: 1 / -1;
  }
  /* Long notes scroll the whole form, so the writing toolbar stays pinned to
     the top of it while the description is on screen (no Ctrl shortcuts on a
     phone). Frosted while pinned, so the lines sliding under it fade out */
  #meetings-inline-toolbar {
    position: sticky;
    top: -16px; /* the section's padding: flush with its top edge */
    z-index: 3;
    --tb-glass: linear-gradient(var(--glass-dialog), var(--glass-dialog));
  }
  /* Three layers of the dialog glass (a nested backdrop blur doesn't render
     inside the dialog's own). Browsers without scroll-state queries keep it on */
  body[data-style="glass"][data-theme] #meetings-inline-toolbar {
    background: var(--glass-reflection), var(--tb-glass), var(--tb-glass), var(--glass-dialog) !important;
  }
  @supports (container-type: scroll-state) {
    /* Not pinned it looks like every other toolbar; the frost fades in on a
       layer behind the buttons once it sticks */
    #meetings-inline-toolbar {
      container-type: scroll-state;
    }
    body[data-style="glass"][data-theme] #meetings-inline-toolbar {
      background: transparent !important;
    }
    body[data-style="glass"][data-theme] #meetings-inline-toolbar::before {
      content: '';
      position: absolute;
      inset: -1px;
      z-index: -1;
      border-radius: inherit;
      background: var(--glass-reflection), var(--tb-glass), var(--tb-glass), var(--glass-dialog);
      opacity: 0;
      transition: opacity 0.15s ease;
      pointer-events: none;
    }
    @container scroll-state(stuck: top) {
      body[data-style="glass"][data-theme] #meetings-inline-toolbar::before {
        opacity: 1;
      }
    }
  }
  /* pinned at the form's top edge, swatches opening upward would be clipped */
  #meetings-inline-toolbar .highlighter-color-dropdown {
    bottom: auto;
    top: calc(100% + 6px);
  }
}

/* Meeting toolbar: hyperlink + convert-to-task buttons */
.meeting-hyperlink-btn,
.meeting-convert-task-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--muted);
  transition: all 0.15s ease;
}
.meeting-hyperlink-btn:hover:not(:disabled),
.meeting-convert-task-btn:hover:not(:disabled) {
  color: var(--brand);
  background: rgba(44, 123, 229, 0.08);
}
.meeting-hyperlink-btn:disabled,
.meeting-convert-task-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ============================================================
   PROJECTS BUTTON (in Eisenhower header)
   ============================================================ */
.btn-projects-header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  color: #9ca3af;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 8px;
}
.btn-projects-header:hover {
  color: var(--text);
  border-color: var(--text);
}
[data-theme="dark"] .btn-projects-header {
  color: #6b7280;
  border-color: #475569;
}
[data-theme="dark"] .btn-projects-header:hover {
  color: var(--text);
  border-color: var(--text);
}

/* ============================================================
   TASK EDITOR: actions-left (Complete + Delete buttons)
   ============================================================ */
.task-editor-actions-left {
  display: flex;
  gap: 8px;
  align-items: center;
}
.task-editor-complete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: #22c55e;
  opacity: 0.7;
  border-radius: 6px;
  transition: all 0.15s ease;
}
.task-editor-complete-btn:hover {
  opacity: 1;
  background: rgba(34, 197, 94, 0.1);
}

/* Task Editor: Linked Project field */
.task-editor-project-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
}
[data-theme="dark"] .task-editor-project-link {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.25);
}
.task-editor-project-link-check {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.task-editor-project-link-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}
.task-editor-project-link-box { display: none; }
.task-editor-project-link-text {
  color: var(--brand);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-editor-project-link-text:hover {
  text-decoration: underline;
}

/* ============================================================
   COMPLETED TASKS BUTTON (in Eisenhower grid)
   ============================================================ */
.eisenhower-completed-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 16px;
  background: transparent;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}
.eisenhower-completed-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
[data-theme="dark"] .eisenhower-completed-btn {
  border-color: #475569;
}
[data-theme="dark"] .eisenhower-completed-btn:hover {
  border-color: var(--accent);
}

/* ============================================================
   COMPLETED TASKS MODAL
   ============================================================ */
.completed-tasks-modal {
  position: fixed;
  inset: 0;
  z-index: 2002;
  display: flex;
  align-items: center;
  justify-content: center;
}
.completed-tasks-modal[hidden] { display: none; }
.completed-tasks-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.completed-tasks-dialog {
  position: relative;
  width: 480px;
  max-width: 90vw;
  max-height: 70vh;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.completed-tasks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.completed-tasks-header h4 { margin: 0; font-size: 16px; }
[data-theme="dark"] .completed-tasks-header { border-bottom-color: #475569; }
.completed-tasks-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}
.completed-tasks-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}
.completed-tasks-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 0;
  font-size: 14px;
}
.completed-task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  background: rgba(34, 197, 94, 0.08);
  border-left: 3px solid #22c55e;
}
[data-theme="dark"] .completed-task-row {
  background: rgba(34, 197, 94, 0.1);
}
.completed-task-title {
  flex: 1;
  font-size: 14px;
  color: var(--text);
}
.completed-task-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.completed-task-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 4px;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.completed-task-delete:hover {
  opacity: 1;
  color: var(--danger);
}
.completed-tasks-actions {
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
}
[data-theme="dark"] .completed-tasks-actions { border-top-color: #475569; }
.completed-tasks-danger-btn {
  color: var(--danger) !important;
  border-color: var(--danger) !important;
}
.completed-tasks-danger-btn:hover {
  background: rgba(239, 68, 68, 0.1) !important;
}

/* ============================================================
   PROJECTS MODAL
   ============================================================ */
.projects-modal {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
}
.projects-modal[hidden] { display: none; }
.projects-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.projects-dialog {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Projects Title Bar */
.projects-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
}
.projects-title-bar h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.projects-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0 4px;
  flex-shrink: 0;
}
.projects-close-btn:hover { color: var(--text); }

/* Projects Header (tabs row) */
.projects-header {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid #e5e7eb;
  min-height: 40px;
  gap: 0;
}
[data-theme="dark"] .projects-header { border-bottom-color: #475569; }
.projects-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
}
.projects-tabs::-webkit-scrollbar { height: 2px; }
.projects-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.projects-tab:hover {
  color: var(--text);
  background: rgba(0,0,0,0.03);
}
[data-theme="dark"] .projects-tab:hover { background: rgba(255,255,255,0.03); }
.projects-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}
.projects-tab-title {
  cursor: pointer;
}
.projects-tab-delete {
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
  color: var(--muted);
  cursor: pointer;
}
.projects-tab:hover .projects-tab-delete { opacity: 0.6; }
.projects-tab-delete:hover { opacity: 1 !important; color: var(--danger); }
.projects-tab-add {
  font-size: 18px;
  font-weight: 600;
  color: var(--muted);
  padding: 12px 20px;
}
.projects-tab-add:hover {
  color: var(--brand);
}
.projects-tab-rename-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--brand);
  color: var(--text);
  font-size: 13px;
  padding: 2px 4px;
  outline: none;
  width: 120px;
}

/* Projects Body */
.projects-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.projects-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--muted);
  font-size: 15px;
}
.projects-empty-state[hidden] { display: none; }
.projects-editor-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.projects-editor-wrap[hidden] { display: none; }

/* Projects Editor Toolbar */
.projects-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
[data-theme="dark"] .projects-editor-toolbar { border-bottom-color: #475569; }

/* Projects Editor */
.project-editor {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  outline: none;
}
.project-editor:empty::before {
  content: 'Start writing your project plan...';
  color: var(--muted);
  pointer-events: none;
}
.project-editor h1 { font-size: 28px; margin: 16px 0 8px; line-height: 1.3; }
.project-editor h2 { font-size: 22px; margin: 14px 0 6px; line-height: 1.3; }
.project-editor h3 { font-size: 18px; margin: 12px 0 4px; line-height: 1.3; }
.project-editor ul, .project-editor ol {
  padding-left: 28px;
  margin: 4px 0;
  list-style-position: inside;
}
.project-editor ul {
  list-style-type: disc !important;
}
.project-editor ol {
  list-style-type: decimal !important;
}
.project-editor li {
  margin: 2px 0;
  display: list-item !important;
  color: var(--text);
}
.project-editor li::marker {
  color: var(--text);
}
.project-editor ul ul {
  list-style-type: circle !important;
}
.project-editor ul ul ul {
  list-style-type: square !important;
}
.project-editor ul ul ul ul {
  list-style-type: disc !important;
}
.project-editor ol ol {
  list-style-type: lower-alpha !important;
}
.project-editor ol ol ol {
  list-style-type: lower-roman !important;
}
.project-editor ol ol ol ol {
  list-style-type: decimal !important;
}

/* Hyperlinks in editors and view panels — clickable with pointer cursor */
.project-editor a[href],
.task-desc-editor a[href],
.task-desc-view-content a[href],
.ideas-editor a[href],
.notepad-editor a[href],
.meetings-view-content a[href] {
  cursor: pointer;
  color: #3b82f6;
  text-decoration: underline;
}
[data-theme="dark"] .project-editor a[href],
[data-theme="dark"] .task-desc-editor a[href],
[data-theme="dark"] .task-desc-view-content a[href],
[data-theme="dark"] .ideas-editor a[href],
[data-theme="dark"] .notepad-editor a[href],
[data-theme="dark"] .meetings-view-content a[href] {
  color: #60a5fa;
}

/* Project Task Highlights (pill-shaped, non-editable) */
.project-task-highlight {
  border-radius: 999px;
  padding: 2px 10px;
  cursor: pointer;
  transition: filter 0.15s ease;
  display: inline;
  -webkit-user-modify: read-only;
}
.project-task-highlight:hover {
  filter: brightness(0.9);
}
.project-task-highlight.completed {
  cursor: default;
}
.project-task-highlight.completed:hover {
  filter: none;
}

/* Toolbar spacer (pushes save + convert buttons to the right) */
.projects-toolbar-spacer {
  flex: 1;
}

/* "Saved!" label next to save button */
.project-save-label {
  font-size: 12px;
  font-weight: 600;
  color: #22c55e;
  opacity: 0;
  transition: opacity 0.2s ease;
  margin-right: 6px;
  white-space: nowrap;
}
.project-save-label.visible {
  opacity: 1;
}

/* Save button in projects toolbar */
.project-save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: default;
  color: var(--muted);
  /* No fade between clean / dirty / saved: under the dialog's frosted glass every
     frame of it redrew the whole screen, and the first one lands on a keystroke */
  margin-right: 8px;
  opacity: 0.4;
}
.project-save-btn.dirty {
  color: #fff;
  background: #22c55e;
  border-color: #22c55e;
  opacity: 1;
  cursor: pointer;
}
.project-save-btn.dirty:hover {
  background: #16a34a;
  border-color: #16a34a;
}
.project-save-btn.saved {
  color: #22c55e;
  border-color: #22c55e;
  background: none;
  opacity: 1;
}
[data-theme="dark"] .project-save-btn {
  border-color: #475569;
}
[data-theme="dark"] .project-save-btn.dirty {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}
[data-theme="dark"] .project-save-btn.saved {
  color: #22c55e;
  border-color: #22c55e;
  background: none;
}

/* Hyperlink + Convert-to-task toolbar buttons (icon-only) */
.project-hyperlink-btn,
.project-convert-task-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--muted);
  transition: all 0.15s ease;
}
.project-hyperlink-btn:hover:not(:disabled),
.project-convert-task-btn:hover:not(:disabled) {
  color: var(--brand);
  background: rgba(44, 123, 229, 0.08);
}
.project-hyperlink-btn:disabled,
.project-convert-task-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ===== AUTH UI ===== */

/* Auth toggle button in header */
.auth-toggle {
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}
.auth-toggle:hover { color: var(--brand); transform: scale(1.1); }
.auth-toggle.logged-in { color: var(--accent); }
.auth-toggle.logged-in:hover { color: var(--brand); }

[data-theme="dark"] .auth-toggle { color: var(--muted); }
[data-theme="dark"] .auth-toggle:hover { color: var(--brand); }
[data-theme="dark"] .auth-toggle.logged-in { color: var(--accent); }

/* Auth Modal */
.auth-modal { position: fixed; inset: 0; display: none; z-index: 2000; }
.auth-modal[hidden] { display: none; }
.auth-modal:not([hidden]) { display: flex; align-items: center; justify-content: center; }
.auth-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.auth-dialog {
  position: relative;
  width: 360px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  border: 1px solid #e5e7eb;
  z-index: 1;
  animation: auth-slide-in 0.2s ease;
}
@keyframes auth-slide-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #e5e7eb;
}
.auth-header h4 { margin: 0; font-size: 18px; font-weight: 600; color: var(--text); }
.auth-close-btn {
  background: none; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; padding: 0;
  color: var(--muted); transition: color 0.15s;
}
.auth-close-btn:hover { color: var(--text); }
.auth-body { padding: 20px; }

.auth-field { margin-bottom: 14px; }
.auth-field label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.auth-field input {
  width: 100%; padding: 10px 12px;
  border: 2px solid #e5e7eb; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  background: #f8fafc; color: var(--text);
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}
.auth-field input:focus { outline: none; border-color: var(--brand); }

.auth-turnstile-container { margin: 16px 0; display: flex; justify-content: center; }

.auth-error {
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px;
  padding: 10px 14px; margin-bottom: 14px;
  font-size: 13px; color: #dc2626; line-height: 1.4;
}

.auth-submit-btn {
  width: 100%; padding: 12px;
  background: var(--brand); color: #fff;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
}
.auth-submit-btn:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.auth-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-footer {
  text-align: center; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid #f1f5f9;
  font-size: 13px; color: var(--muted);
}
.auth-link-btn {
  background: none; border: none;
  color: var(--brand); cursor: pointer;
  font-size: 13px; font-weight: 500;
  padding: 0; margin-left: 4px;
  text-decoration: underline;
}
.auth-link-btn:hover { opacity: 0.8; }

.auth-disclaimer {
  text-align: center; font-size: 11px;
  color: var(--muted); margin: 12px 0 0;
  opacity: 0.8;
}

/* Continue with Google (Google's own button look: white / dark, the four-colour G) */
.auth-google-area { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.auth-google-area[hidden] { display: none; }
.auth-google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: #fff; color: #1f1f1f;
  border: 1px solid #dadce0; border-radius: 10px;
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-google-btn:hover:not(:disabled) { border-color: #c4c7c5; box-shadow: 0 1px 3px rgba(0,0,0,0.14); }
.auth-google-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-google-logo { flex: 0 0 auto; }
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: #e5e7eb; }
.auth-google-note { margin: 0 0 14px; font-size: 13px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.auth-field[hidden], .auth-footer[hidden] { display: none; }
[data-theme="dark"] .auth-google-btn { background: #131314; color: #e3e3e3; border-color: #8e918f; }
[data-theme="dark"] .auth-google-btn:hover:not(:disabled) { border-color: #c4c7c5; }
[data-theme="dark"] .auth-divider::before, [data-theme="dark"] .auth-divider::after { background: #334155; }
body.glass-mode .auth-divider::before, body.glass-mode .auth-divider::after { background: rgba(255,255,255,0.22); }

/* Auth User Popover (logged-in state) */
.auth-user-popover {
  position: fixed; z-index: 1500;
  background: var(--card);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  padding: 14px 16px;
  min-width: 200px;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: auth-slide-in 0.15s ease;
}
.auth-user-popover[hidden] { display: none; }

.auth-user-info {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; color: var(--text);
  margin-bottom: 8px;
}
.auth-user-info svg { color: var(--muted); flex-shrink: 0; }

.auth-sync-status {
  font-size: 12px; color: var(--muted);
  margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}
.auth-sync-status:empty { display: none; }

.auth-logout-btn {
  width: 100%; padding: 8px 12px;
  background: transparent; border: 1px solid #e5e7eb;
  border-radius: 8px; font-size: 13px; font-weight: 500;
  color: var(--text); cursor: pointer;
  transition: all 0.15s ease;
}
.auth-logout-btn:hover { border-color: var(--danger); color: var(--danger); }

/* Dark mode overrides for auth */
[data-theme="dark"] .auth-dialog { border-color: #334155; }
[data-theme="dark"] .auth-header { border-bottom-color: #334155; }
[data-theme="dark"] .auth-field input { background: #334155; border-color: #475569; }
[data-theme="dark"] .auth-field input:focus { border-color: var(--brand); }
[data-theme="dark"] .auth-error { background: #451a1a; border-color: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .auth-footer { border-top-color: #334155; }
[data-theme="dark"] .auth-user-popover { border-color: #334155; }
[data-theme="dark"] .auth-sync-status { border-bottom-color: #334155; }
[data-theme="dark"] .auth-logout-btn { border-color: #475569; }
[data-theme="dark"] .auth-logout-btn:hover { border-color: var(--danger); }

/* Glass mode overrides for auth */
body.glass-mode .auth-dialog {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-color: rgba(255,255,255,0.2);
}
body.glass-mode .auth-user-popover {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-color: rgba(255,255,255,0.2);
}
body.glass-mode .auth-field input {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
}
body.glass-mode[data-theme="dark"] .auth-dialog {
  background: rgba(30,41,59,0.7);
  border-color: rgba(255,255,255,0.1);
}
body.glass-mode[data-theme="dark"] .auth-user-popover {
  background: rgba(30,41,59,0.7);
  border-color: rgba(255,255,255,0.1);
}

/* Google Calendar panel (google-calendar.js buildGcalPanel): the account
   popover on a computer; the phone More sheet adds its own sizes (mobile-today.css §4) */
.auth-gcal {
  width: 280px; max-width: calc(100vw - 48px);
  margin-bottom: 12px; padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.auth-gcal:empty { display: none; }
/* Google sign-in panel (auth-ui.js buildGoogleSigninPanel): same look, above it */
.auth-google {
  width: 280px; max-width: calc(100vw - 48px);
  margin-bottom: 12px; padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.auth-google:empty { display: none; }
[data-theme="dark"] .auth-google { border-bottom-color: #334155; }
body.glass-mode .auth-google { border-bottom-color: rgba(255,255,255,0.18); }
.gcal-panel { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text); }
.gcal-panel-title { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.gcal-note { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.gcal-note.gcal-warn { color: var(--danger); }
.gcal-who { margin: 0; display: flex; flex-direction: column; gap: 1px; font-weight: 600; }
.gcal-email { font-size: 12px; font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }
.gcal-perms { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.gcal-perms li { position: relative; padding-left: 15px; }
.gcal-perms li::before {
  content: ""; position: absolute; left: 1px; top: 0.45em;
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; opacity: 0.45;
}
.gcal-perms li.is-on { color: var(--text); }
.gcal-perms li.is-on::before { background: #10b981; opacity: 1; }
.gcal-busy-cals { display: grid; gap: 6px; }
.gcal-sub { font-size: 12px; font-weight: 600; }
.gcal-cal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.gcal-cal { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; }
.gcal-cal-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcal-cal-add { display: flex; gap: 6px; }
.gcal-cal-add input {
  flex: 1; min-width: 0; padding: 6px 8px;
  border: 1px solid #e5e7eb; border-radius: 8px;
  background: transparent; color: var(--text); font: inherit; font-size: 12px;
}
.gcal-cal-add input:focus { outline: none; border-color: var(--brand); }
.gcal-hint { margin: 0; font-size: 11px; line-height: 1.4; color: var(--muted); }
.gcal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.gcal-actions > .gcal-note, .gcal-check { flex-basis: 100%; }
.gcal-check { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; line-height: 1.4; cursor: pointer; }
.gcal-check input { margin: 2px 0 0; flex: 0 0 auto; }
.gcal-btn {
  padding: 6px 12px;
  border: 1px solid #e5e7eb; border-radius: 8px;
  background: transparent; color: var(--text);
  font: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.gcal-btn:hover { border-color: var(--brand); color: var(--brand); }
.gcal-btn-primary { align-self: flex-start; background: var(--brand); border-color: var(--brand); color: #fff; }
.gcal-btn-primary:hover { color: #fff; }
.gcal-btn-danger { border-color: var(--danger); color: var(--danger); }
.gcal-btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.gcal-btn-quiet { border-color: transparent; color: var(--muted); }
.gcal-cal-remove { padding: 0 7px; line-height: 1.5; }
[data-theme="dark"] .auth-gcal { border-bottom-color: #334155; }
[data-theme="dark"] :is(.gcal-btn, .gcal-cal-add input) { border-color: #475569; }
[data-theme="dark"] .gcal-btn-primary { border-color: var(--brand); }
[data-theme="dark"] .gcal-btn-danger { border-color: var(--danger); }
[data-theme="dark"] .gcal-btn-quiet { border-color: transparent; }
body.glass-mode .auth-gcal { border-bottom-color: rgba(255,255,255,0.18); }
body.glass-mode :is(.gcal-btn:not(.gcal-btn-primary, .gcal-btn-danger, .gcal-btn-quiet), .gcal-cal-add input) { border-color: rgba(255,255,255,0.25); }

/* ============================================================
   @ Task Mention Autocomplete Dropdown
   ============================================================ */
.task-mention-dropdown {
  position: fixed;
  z-index: 100000;
  max-height: 360px;
  overflow-y: auto;
  background: var(--card, #ffffff);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 8px;
  display: flex;
  flex-direction: row;
  gap: 6px;
}
.task-mention-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.task-mention-item {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.1s ease, box-shadow 0.12s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Hover is a light touch; the keyboard pick (.selected) carries a ring so it
   reads in both themes (darkening alone made the pick look "off" in dark mode,
   and a resting pointer looked like a second pick) */
.task-mention-item:hover { filter: brightness(0.95); }
.task-mention-item.selected {
  filter: none;
  transform: scale(1.03);
  box-shadow: 0 0 0 2px var(--brand);
}
[data-theme="dark"] .task-mention-item:hover { filter: brightness(1.12); }
[data-theme="dark"] .task-mention-item.selected { filter: brightness(1.25); }
.task-mention-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-mention-primary-badge {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.15);
  flex-shrink: 0;
  line-height: 1;
}
.task-mention-empty {
  padding: 12px 16px;
  color: var(--muted, #6b7280);
  font-size: 13px;
  text-align: center;
}

/* ============================================================
   Quick Capture (js/features/quick-capture.js)
   N anywhere opens a one-line bar above everything. The @ list reuses the
   .task-mention-* look; category options reuse .task-category-chip.
   ============================================================ */

/* Header bolt: Mobile layout only (body[data-device] is set by grid-engine.js) */
.quick-capture-toggle {
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}
body[data-device="mobile"] .quick-capture-toggle { display: flex; }
.quick-capture-toggle:hover {
  color: var(--brand);
  transform: scale(1.1);
}

.qc-overlay {
  position: fixed;
  inset: 0;
  z-index: 100100; /* above every modal, popover and the @ mention list */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: max(16px, 12vh) 16px 16px;
}
.qc-overlay[hidden] { display: none; }

.qc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.qc-dialog {
  position: relative;
  width: 640px;
  max-width: 100%;
  padding: 12px 12px 10px;
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 22px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.35);
}
/* Transform only: opacity on a glass pane cuts off its backdrop sampling */
.qc-overlay.open .qc-dialog { animation: qcIn 0.16s ease-out; }
.qc-overlay.open .qc-dialog.qc-shake { animation: qcShake 0.32s ease; }
@keyframes qcIn {
  from { transform: translateY(-8px) scale(0.985); }
  to { transform: none; }
}
@keyframes qcShake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.qc-field-wrap { position: relative; }
.qc-field {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-height: 50px;
  padding: 6px 6px 6px 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 16px;
  background: var(--glass-field, #f8fafc);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.qc-field:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(66, 105, 155, 0.18);
}
.qc-field-icon {
  display: flex;
  flex-shrink: 0;
  color: var(--brand);
}
.qc-field-icon svg { width: 18px; height: 18px; }

.qc-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
}
.qc-tokens[hidden] { display: none; }
.qc-token {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  min-width: 0;
  padding: 3px 5px 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.qc-token.task-category-chip { padding: 3px 5px 3px 10px; cursor: default; }
.qc-token-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.qc-token-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  color: inherit;
  cursor: pointer;
}
.qc-token-remove:hover { background: rgba(0, 0, 0, 0.22); }
.qc-token-remove svg { width: 11px; height: 11px; }

.qc-input {
  flex: 1 1 160px;
  min-width: 120px;
  padding: 8px 4px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px keeps iOS from zooming in on focus */
}
.qc-input::placeholder { color: var(--muted); opacity: 0.85; }
/* The whole field shows focus (.qc-field:focus-within); outrank glass.css's input outline */
body[data-style][data-theme] .qc-field .qc-input:focus-visible { outline: none; }

.qc-info-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.qc-info-btn:hover,
.qc-info-btn:focus-visible { color: var(--brand); background: var(--glass-hover, rgba(0, 0, 0, 0.05)); }
.qc-info-btn svg { width: 20px; height: 20px; }

/* Lists under the field: @ tasks (one column per matrix color) and categories */
.qc-picker.task-mention-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 2;
  max-height: min(320px, 45vh);
  overflow-x: hidden; /* the highlighted pill's 1.03 zoom must not add a sideways scrollbar */
  padding: 8px 10px;
}
.qc-picker[hidden] { display: none; }
.qc-picker .task-mention-col { flex: 1 1 0; }
.qc-picker.qc-picker-cats {
  flex-direction: column;
  align-items: stretch;
}
.qc-picker-empty { flex: 1; }
.qc-cat-option { justify-content: flex-start; }
.qc-cat-option.selected {
  border-color: var(--chip-color);
  background: color-mix(in srgb, var(--chip-color) 18%, var(--glass-field, #fff));
  box-shadow: 0 0 0 1.5px var(--chip-color);
}

/* Live preview: what Enter will do */
.qc-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
  padding: 10px 2px 2px;
}
.qc-pv {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  padding: 4px 10px;
  border: 1px solid var(--glass-divider, rgba(0, 0, 0, 0.08));
  border-radius: 999px;
  background: var(--glass-field, rgba(0, 0, 0, 0.04));
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.35;
  text-align: left;
}
button.qc-pv { cursor: pointer; }
button.qc-pv:hover { border-color: var(--brand); }
.qc-pv-icon { display: inline-flex; flex-shrink: 0; }
.qc-pv-icon svg { width: 14px; height: 14px; }
.qc-pv-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.qc-pv-label {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.qc-pv-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qc-pv-task .qc-pv-text { font-weight: 600; }
.qc-pv-default { color: var(--muted); }
.qc-pv-error .qc-pv-text,
.qc-pv-warning .qc-pv-text,
.qc-pv-hint .qc-pv-text { white-space: normal; }
.qc-pv-error {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.38);
}
.qc-pv-warning {
  color: #92400e;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.42);
}
.qc-pv-hint { color: var(--muted); }
[data-theme="dark"] .qc-pv-error { color: #fca5a5; background: rgba(239, 68, 68, 0.16); border-color: rgba(248, 113, 113, 0.4); }
[data-theme="dark"] .qc-pv-warning { color: #fcd34d; background: rgba(245, 158, 11, 0.14); border-color: rgba(251, 191, 36, 0.4); }

.qc-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.qc-hint-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
/* :where() keeps this at zero specificity, so .task-bubble-* colors the !red / !blue examples */
:where(.qc-code) {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--glass-divider, rgba(0, 0, 0, 0.1));
  border-radius: 7px;
  background: var(--glass-field, rgba(0, 0, 0, 0.05));
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
}
button.qc-code { cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease; }
button.qc-code:hover,
button.qc-code:focus-visible { border-color: var(--brand); color: var(--brand); }
button.qc-code[class*="task-bubble-"]:hover,
button.qc-code[class*="task-bubble-"]:focus-visible { color: inherit; filter: brightness(0.94); }

/* Bottom row: "See all commands" on the left, key hints on the right */
.qc-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 14px;
  padding: 8px 4px 0;
  font-size: 11.5px;
  color: var(--muted);
}
.qc-footer-help { font-size: 12px; }
.qc-footer-keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 14px;
  margin-left: auto;
}
.qc-overlay kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--glass-divider, rgba(0, 0, 0, 0.15));
  border-radius: 5px;
  background: var(--glass-field, #fff);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  line-height: 1.6;
}
/* No physical keyboard hints on phones (the commands link stays) */
body[data-device="mobile"] .qc-footer-keys { display: none; }
@media (hover: none) and (pointer: coarse) { .qc-footer-keys { display: none; } }

/* ⓘ command reference, stacked above the bar */
.qc-help {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.qc-help[hidden] { display: none; }
.qc-help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
}
.qc-help-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 660px;
  max-width: 100%;
  max-height: min(80vh, 760px);
  overflow: hidden;
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 22px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.35);
}
.qc-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px 22px;
}
.qc-help-header h4 { margin: 0; font-size: 17px; font-weight: 600; }
.qc-help-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.qc-help-close:hover,
.qc-help-close:focus-visible { color: var(--text); background: var(--glass-hover, rgba(0, 0, 0, 0.06)); }
.qc-help-close svg { width: 16px; height: 16px; }
.qc-help-body {
  overflow-y: auto;
  padding: 0 22px 20px;
}
.qc-help-section h5 {
  margin: 14px 0 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.qc-help-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 4px 16px;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid var(--glass-divider, rgba(0, 0, 0, 0.06));
}
.qc-help-examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.qc-help-meaning { font-size: 13px; line-height: 1.45; }
.qc-help-foot { margin: 16px 0 0; font-size: 12px; color: var(--muted); }
@media (max-width: 560px) {
  .qc-help-row { grid-template-columns: 1fr; }
}

/* Toast with Open / Undo (the shared #toast is text only) */
.qc-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100200;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100vw - 32px);
  padding: 7px 7px 7px 14px;
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 14px;
  transform: translate(-50%, 16px);
  transition: transform 0.18s ease;
}
.qc-toast.show { transform: translate(-50%, 0); }
.qc-toast[hidden] { display: none; }
.qc-toast-msg {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qc-toast-btn {
  flex-shrink: 0;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.qc-toast-btn:hover,
.qc-toast-btn:focus-visible { background: rgba(255, 255, 255, 0.24); }

[data-theme="dark"] .qc-dialog,
[data-theme="dark"] .qc-help-dialog { border-color: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .qc-field { border-color: rgba(255, 255, 255, 0.14); }
[data-theme="dark"] .qc-backdrop,
[data-theme="dark"] .qc-help-backdrop { background: rgba(2, 6, 14, 0.5); }
[data-theme="dark"] .qc-token-remove { background: rgba(255, 255, 255, 0.16); }
[data-theme="dark"] .qc-token-remove:hover { background: rgba(255, 255, 255, 0.28); }

@media (prefers-reduced-motion: reduce) {
  .qc-overlay.open .qc-dialog,
  .qc-overlay.open .qc-dialog.qc-shake { animation: none; }
  .qc-toast { transition: none; }
}

/* ============================================================
   Item Creator (js/features/item-creator.js): add a card item in one window
   ============================================================ */
.ic-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000; /* above the Card Edit Modal (2000) and item popovers (2500); the media library (4000) opens above it */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: max(16px, 9vh) 16px 16px;
  overflow-y: auto;
}
.ic-overlay[hidden] { display: none; }
.ic-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}
.ic-dialog {
  position: relative;
  width: 480px;
  max-width: 100%;
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 22px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}
/* Transform only: opacity on a glass pane cuts off its backdrop sampling */
.ic-overlay.open .ic-dialog { animation: qcIn 0.16s ease-out; }
.ic-overlay.open .ic-dialog.ic-shake { animation: qcShake 0.32s ease; }

.ic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 6px;
}
.ic-header h4 {
  margin: 0;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ic-card-name { color: var(--brand); }
.ic-close {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ic-close svg { width: 18px; height: 18px; }
.ic-close:hover { background: rgba(0, 0, 0, 0.06); color: var(--text); }

.ic-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 14px 4px;
}
.ic-tab {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  background: var(--glass-field, #f8fafc);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.ic-tab svg { width: 22px; height: 22px; }
.ic-tab span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ic-tab:hover { color: var(--text); }
.ic-tab[aria-selected="true"] {
  color: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(66, 105, 155, 0.14);
}
.ic-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.ic-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px 18px 6px;
}
.ic-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ic-overlay [hidden] { display: none !important; }
.ic-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
}
.ic-label-row .ic-seg { margin-left: auto; }
.ic-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
.ic-optional { font-size: 11px; color: var(--muted); opacity: 0.8; }
.ic-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  background: var(--glass-field, #f8fafc);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ic-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(66, 105, 155, 0.18);
}
.ic-textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
select.ic-input { cursor: pointer; }

.ic-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
}
.ic-seg button {
  padding: 5px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.ic-seg button[aria-checked="true"] {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.ic-seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.ic-image-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.ic-image-preview {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border: 1px dashed rgba(0, 0, 0, 0.2);
  border-radius: 14px;
  background: var(--glass-field, #f8fafc);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ic-image-preview svg { width: 22px; height: 22px; opacity: 0.6; }
.ic-image-preview.has-image { border-style: solid; }
.ic-image-preview img { width: 32px; height: 32px; object-fit: contain; }
.ic-preview-emoji { font-size: 28px; line-height: 1; }
.ic-btn {
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 11px;
  background: var(--glass-field, #fff);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.ic-btn:hover { border-color: rgba(0, 0, 0, 0.24); }
.ic-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ic-emoji { margin-top: 4px; }

.ic-file-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ic-file-name {
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ic-note { margin: 0; font-size: 12px; color: var(--muted); }

.ic-track { display: flex; flex-direction: column; gap: 10px; }
.ic-grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.ic-sub { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ic-sub > span { font-size: 12px; color: var(--muted); }

.ic-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.ic-check input { width: 16px; height: 16px; accent-color: var(--brand); }
.ic-sep-note p { margin: 0; font-size: 14px; line-height: 1.5; }

.ic-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 16px;
}
.ic-missing { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); }
.ic-missing.is-error { color: #dc2626; font-weight: 600; }
.ic-save {
  padding: 7px 20px;
  border-color: transparent;
  background: var(--brand);
  color: #fff;
}
.ic-save:hover { border-color: transparent; filter: brightness(1.07); }
.ic-save[aria-disabled="true"] { opacity: 0.5; }

@media (max-width: 520px) {
  .ic-overlay { padding: 10px; }
  .ic-tabs { gap: 4px; padding: 6px 10px 2px; }
  .ic-tab { padding: 8px 2px 6px; font-size: 11px; }
  /* "Copy-paste" breaks at its hyphen instead of being cut off */
  .ic-tab span { white-space: normal; line-height: 1.15; text-align: center; overflow: visible; }
  .ic-body { padding: 10px 14px 4px; }
  .ic-footer { flex-wrap: wrap; padding: 12px 14px 14px; }
  .ic-missing { flex-basis: 100%; }
  .ic-footer .ic-btn { flex: 1; min-height: 42px; }
}

[data-theme="dark"] .ic-dialog { border-color: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .ic-backdrop { background: rgba(2, 6, 14, 0.5); }
[data-theme="dark"] .ic-input,
[data-theme="dark"] .ic-tab,
[data-theme="dark"] .ic-btn:not(.ic-save) { border-color: rgba(255, 255, 255, 0.14); }
[data-theme="dark"] .ic-seg { background: rgba(255, 255, 255, 0.07); }
[data-theme="dark"] .ic-seg button[aria-checked="true"] { background: rgba(255, 255, 255, 0.14); }
[data-theme="dark"] .ic-close:hover { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .ic-image-preview { border-color: rgba(255, 255, 255, 0.22); }
[data-theme="dark"] .ic-missing.is-error { color: #f87171; }

/* The item that was just added glows once (filter: the glass box-shadows
   would drown a box-shadow pulse) */
.ic-just-added { animation: icJustAdded 2.4s ease-out; }
@keyframes icJustAdded {
  0% { filter: drop-shadow(0 0 0 rgba(59, 130, 246, 0)); }
  18% { filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.75)); }
  45% { filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.45)); }
  65% { filter: drop-shadow(0 0 9px rgba(59, 130, 246, 0.6)); }
  100% { filter: drop-shadow(0 0 0 rgba(59, 130, 246, 0)); }
}

/* Separator placement: markers in every gap between two icons, a crosshair,
   and everything that can't take a separator fades back */
html.sep-placing-active body,
html.sep-placing-active body * { cursor: crosshair !important; }
html.sep-placing-active .sep-place-hint,
html.sep-placing-active .sep-place-hint * { cursor: default !important; }
html.sep-placing-active .sep-place-cancel { cursor: pointer !important; }
section.card.sep-placing .unified-icons-group { position: relative; }
section.card.sep-placing .unified-content-group > :not(.unified-icons-group),
section.card.sep-placing .unified-subtitle-wrapper,
section.card.sep-placing .unified-add-tile,
section.card.sep-placing .unified-add-subtitle {
  opacity: 0.35;
  transition: opacity 0.2s ease;
}
.sep-slot {
  position: absolute;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: rgba(59, 130, 246, 0.45);
  pointer-events: none;
}
.sep-place-hint {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 2460;
  width: max-content;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border-radius: 14px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow);
}
.sep-place-hint-key { color: rgba(255, 255, 255, 0.7); white-space: nowrap; }
.sep-place-hint kbd {
  padding: 1px 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  font: inherit;
  font-size: 11px;
}
.sep-place-cancel {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}
.sep-place-cancel:hover,
.sep-place-cancel:focus-visible { background: rgba(255, 255, 255, 0.24); }
@media (hover: none) {
  .sep-place-hint-key { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ic-overlay.open .ic-dialog,
  .ic-overlay.open .ic-dialog.ic-shake,
  .ic-just-added { animation: none; }
}

/* ============================================================
   Text Highlighter
   ============================================================ */

/* Toolbar button wrapper */
.highlighter-btn-wrapper {
  position: relative;
  display: inline-flex;
}
.highlighter-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}
.highlighter-toolbar-btn:hover {
  background: rgba(0,0,0,0.08);
}
[data-theme="dark"] .highlighter-toolbar-btn:hover {
  background: rgba(255,255,255,0.1);
}
.highlighter-color-indicator {
  width: 12px;
  height: 4px;
  border-radius: 2px;
  display: block;
}

/* Color picker dropdown */
.highlighter-color-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: var(--card, #ffffff);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 100001;
}
[data-theme="dark"] .highlighter-color-dropdown {
  background: var(--card, #1e293b);
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
.highlighter-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
  padding: 0;
}
.highlighter-swatch:hover {
  transform: scale(1.15);
}
.highlighter-swatch.active {
  border-color: var(--text, #1f2937);
}

/* Right-click context menu */
.highlight-context-menu,
.item-context-menu {
  position: fixed;
  z-index: 100002;
  background: var(--card, #ffffff);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 4px;
  min-width: 160px;
}
[data-theme="dark"] .highlight-context-menu,
[data-theme="dark"] .item-context-menu {
  background: var(--card, #1e293b);
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.highlight-context-item,
.item-context-action {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.12s;
}
.highlight-context-item:hover,
.item-context-action:hover {
  background: rgba(0,0,0,0.06);
}
[data-theme="dark"] .highlight-context-item:hover,
[data-theme="dark"] .item-context-action:hover {
  background: rgba(255,255,255,0.08);
}
.item-context-menu { max-width: calc(100vw - 16px); }
.item-context-action { text-align: left; }
.item-context-action svg { flex-shrink: 0; }
.item-context-action:focus-visible { outline: 2px solid var(--accent, #23a8ff); outline-offset: -2px; }
.item-hold-menu { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
@media (pointer: coarse) {
  .item-context-action { min-height: 44px; font-size: 15px; }
}
.highlight-context-divider {
  height: 1px;
  background: rgba(0,0,0,0.08);
  margin: 2px 8px;
}
[data-theme="dark"] .highlight-context-divider {
  background: rgba(255,255,255,0.08);
}

/* Task Link Picker (opened from context menu) */
.task-link-picker {
  position: fixed;
  z-index: 100003;
  max-height: 360px;
  overflow-y: auto;
  background: var(--card, #ffffff);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
[data-theme="dark"] .task-link-picker {
  background: var(--card, #1e293b);
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.task-link-picker-filter {
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  background: var(--bg, #f5f6f8);
  color: var(--text);
}
[data-theme="dark"] .task-link-picker-filter {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
}
.task-link-picker-filter:focus {
  border-color: var(--brand);
}
.task-link-picker-cols {
  display: flex;
  flex-direction: row;
  gap: 6px;
}
.task-link-picker-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.task-link-picker-empty {
  padding: 12px 16px;
  color: var(--muted, #6b7280);
  font-size: 13px;
  text-align: center;
}

/* The highlight mark itself */
mark.text-highlight {
  border-radius: 3px;
  padding: 1px 2px;
}

/* Dark mode */
[data-theme="dark"] .task-mention-dropdown {
  background: var(--card, #1e293b);
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* ============================================================
   Calendar View Modal
   ============================================================ */
.calendar-view-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calendar-view-modal[hidden] {
  display: none;
}
.calendar-view-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
}
/* Calendar on the left, Due Today + Overdue on the right (stacked on phones) */
.calendar-view-dialog {
  position: relative;
  width: min(900px, calc(100vw - 32px));
  max-height: 90vh;
  background: var(--card, #ffffff);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
[data-theme="dark"] .calendar-view-dialog {
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.calendar-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.calendar-view-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
[data-theme="dark"] .calendar-view-header {
  border-bottom-color: rgba(255,255,255,0.08);
}
.calendar-view-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  padding: 0;
  transition: color 0.15s;
}
.calendar-view-close:hover { color: var(--text); }

.calendar-view-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  gap: 24px;
  align-items: start;
}
.calendar-view-main { min-width: 0; }
.calendar-view-day-hint {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 6px 8px 2px;
}
.calendar-view-due {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-left: 24px;
  border-left: 1px solid rgba(0,0,0,0.06);
  align-self: stretch;
}
[data-theme="dark"] .calendar-view-due {
  border-left-color: rgba(255,255,255,0.06);
}
@media (max-width: 760px) {
  .calendar-view-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 12px 14px 16px;
  }
  .calendar-view-due {
    padding-left: 0;
    border-left: none;
    padding-top: 14px;
    border-top: 1px solid rgba(0,0,0,0.06);
  }
  [data-theme="dark"] .calendar-view-due { border-top-color: rgba(255,255,255,0.06); }
}

/* Navigation */
.calendar-view-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
/* The month label is a button: back to today */
.calendar-view-month-label {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
}
.calendar-view-month-label:hover {
  background: rgba(0,0,0,0.05);
}
[data-theme="dark"] .calendar-view-month-label:hover {
  background: rgba(255,255,255,0.08);
}
.calendar-view-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 6px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
}
.calendar-view-nav-btn:hover {
  color: var(--text);
  background: rgba(0,0,0,0.05);
}
[data-theme="dark"] .calendar-view-nav-btn:hover {
  background: rgba(255,255,255,0.08);
}

/* Weekday headers */
.calendar-view-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* Day grid */
.calendar-view-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.calendar-view-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  min-height: 40px;
}
.calendar-view-day:hover {
  background: rgba(0,0,0,0.04);
}
[data-theme="dark"] .calendar-view-day:hover {
  background: rgba(255,255,255,0.06);
}
.calendar-view-day.other-month {
  opacity: 0.35;
}
.calendar-view-day.today .calendar-view-day-num {
  background: var(--brand);
  color: white;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calendar-view-day.selected {
  background: rgba(44, 123, 229, 0.1);
}
[data-theme="dark"] .calendar-view-day.selected {
  background: rgba(59, 130, 246, 0.15);
}
.calendar-view-day-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

/* Indicator dot + count */
.calendar-view-day-indicator {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 3px;
}
.calendar-view-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
}
.calendar-view-dot-count {
  font-size: 9px;
  font-weight: 700;
  color: #ef4444;
  line-height: 1;
}

/* Lists: the selected day (under the grid) and Due Today / Overdue (right) */
.calendar-view-day-items {
  margin-top: 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
[data-theme="dark"] .calendar-view-day-items {
  border-top-color: rgba(255,255,255,0.06);
}
.calendar-view-due-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.calendar-view-list-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--brand);
  padding: 2px 10px 6px;
}
.calendar-view-day-items > .calendar-view-list-heading {
  color: var(--muted);
}
.calendar-view-due-section.is-overdue .calendar-view-list-heading {
  color: #ef4444;
}
.calendar-view-list-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgb(44 123 229 / 14%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  letter-spacing: 0;
}
.calendar-view-due-section.is-overdue .calendar-view-list-count {
  background: rgb(239 68 68 / 14%);
}
.calendar-view-no-items {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 8px;
}
.calendar-view-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 0.12s;
}
.calendar-view-item.is-clickable { cursor: pointer; }
.calendar-view-item.is-clickable:hover {
  background: rgba(0,0,0,0.04);
}
[data-theme="dark"] .calendar-view-item.is-clickable:hover {
  background: rgba(255,255,255,0.06);
}
.calendar-view-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.calendar-view-item-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  min-width: 0;
  flex: 1;
}
.calendar-view-item-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
  flex-shrink: 0;
}
.calendar-view-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.calendar-view-item-detail {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1000;
}
/* Right column: the detail (parent task, card, "Recurring") gets its own line */
.calendar-view-due .calendar-view-item-label {
  flex-wrap: wrap;
  row-gap: 1px;
}
.calendar-view-due .calendar-view-item-title { flex: 1; }
.calendar-view-due .calendar-view-item-detail {
  flex-basis: 100%;
  flex-shrink: 1;
}
.calendar-view-due .calendar-view-item { align-items: flex-start; }
.calendar-view-due .calendar-view-item-dot,
.calendar-view-due .calendar-view-item-chip { margin-top: 4px; }
.calendar-view-due .calendar-view-item-dot { margin-top: 6px; }
.calendar-view-item-chip {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #dc2626;
  background: rgba(239, 68, 68, 0.12);
  border-radius: 999px;
  padding: 2px 7px;
}
[data-theme="dark"] .calendar-view-item-chip {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.16);
}

/* ============================================================
   CHECKLIST (inside contenteditable editors)
   ============================================================ */
ul.checklist,
.project-editor ul.checklist,
.task-desc-editor ul.checklist,
.ideas-editor ul.checklist,
.notepad-editor ul.checklist {
  list-style: none !important;
  padding-left: 8px;
  margin: 4px 0;
}
ul.checklist > li {
  position: relative;
  padding-left: 28px;
  margin: 3px 0;
  min-height: 22px;
  list-style-type: none !important;
}
ul.checklist > li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}
ul.checklist > li:hover::before {
  border-color: #94a3b8;
}
ul.checklist > li.checked {
  color: #16a34a;
  text-decoration: line-through;
  text-decoration-color: #16a34a;
}
ul.checklist > li.checked::before {
  background: #22c55e;
  border-color: #22c55e;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 10px;
  background-position: center;
  background-repeat: no-repeat;
}

/* Nested checklists */
ul.checklist ul.checklist {
  padding-left: 4px;
  margin: 2px 0;
}

/* Dark mode checklist */
[data-theme="dark"] ul.checklist > li::before {
  border-color: #4b5563;
}
[data-theme="dark"] ul.checklist > li:hover::before {
  border-color: #6b7280;
}
[data-theme="dark"] ul.checklist > li.checked {
  color: #4ade80;
  text-decoration-color: #4ade80;
}
[data-theme="dark"] ul.checklist > li.checked::before {
  /* background-color only: the shorthand would drop the tick image */
  background-color: #22c55e;
  border-color: #22c55e;
}

/* ============================================================
   EDIT MODE - MINIMALISTIC TILE VIEW
   ============================================================ */
/* Edit mode tiles: zoom out, JS sets grid-auto-rows to square cell px value */
.app-main.edit-mode-tiles {
  zoom: 0.7;
  /* grid-auto-rows is set by applyCellSize() in grid-engine.js */
}
/* Cards in tile mode: show real view-mode proportions, non-interactive */
.app-main.edit-mode-tiles .card:not(.app-header):not(.time-tracking-card):not(.quick-access-card):not(.eisenhower-card) {
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow 0.15s ease;
  pointer-events: auto;
}
.app-main.edit-mode-tiles .card:not(.app-header):not(.time-tracking-card):not(.quick-access-card):not(.eisenhower-card):hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  outline: 2px solid var(--brand, #3b82f6);
  outline-offset: -2px;
}
/* Card content is non-interactive in tile mode (click card to open editor) */
.app-main.edit-mode-tiles .card * {
  pointer-events: none;
}
/* But the card itself and resize handles remain interactive */
.app-main.edit-mode-tiles .card {
  pointer-events: auto;
}
.app-main.edit-mode-tiles .card .card-resize-handle-right,
.app-main.edit-mode-tiles .card .card-resize-handle-bottom,
.app-main.edit-mode-tiles .card .card-resize-handle-left,
.app-main.edit-mode-tiles .card .card-resize-handle-top {
  pointer-events: auto;
}
/* Color accent on left edge */
.app-main.edit-mode-tiles .card:not(.app-header) {
  border-left: 4px solid var(--brand, #3b82f6);
}
/* Drag handle cursor for title */
.app-main.edit-mode-tiles .card:not(.app-header) .section-title-wrapper {
  cursor: grab;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Resize handles */
.card-resize-handle-right {
  display: none;
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 20;
}
.card-resize-handle-bottom {
  display: none;
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 8px;
  cursor: row-resize;
  z-index: 20;
}
.card-resize-handle-left {
  display: none;
  position: absolute;
  top: 0;
  left: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 20;
}
.card-resize-handle-top {
  display: none;
  position: absolute;
  top: -4px;
  left: 0;
  width: 100%;
  height: 8px;
  cursor: row-resize;
  z-index: 20;
}
.app-main.edit-mode-tiles .card-resize-handle-right,
.app-main.edit-mode-tiles .card-resize-handle-bottom,
.app-main.edit-mode-tiles .card-resize-handle-left,
.app-main.edit-mode-tiles .card-resize-handle-top {
  display: block;
}
/* Resize visual feedback */
.card-resize-handle-right:hover,
.card-resize-handle-right.active,
.card-resize-handle-bottom:hover,
.card-resize-handle-bottom.active,
.card-resize-handle-left:hover,
.card-resize-handle-left.active,
.card-resize-handle-top:hover,
.card-resize-handle-top.active {
  background: rgba(59, 130, 246, 0.3);
  border-radius: 4px;
}
/* Resize span indicator tooltip */
.resize-span-indicator {
  position: fixed;
  background: #1e293b;
  color: #f8fafc;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  z-index: 10000;
  white-space: nowrap;
}

/* ============================================================
   CARD EDIT MODAL
   ============================================================ */
.card-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  /* Hide scrollbar but keep scroll functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  padding: 4vh 0;
}
.card-edit-modal::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.card-edit-modal[hidden] { display: none; }
.card-edit-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
/* Bottom fade gradient — indicates more content below */
.card-edit-modal::after {
  content: '';
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.4));
  pointer-events: none;
  z-index: 2001;
}
.card-edit-panel {
  position: relative;
  z-index: 1;
}
.card-edit-body {
  padding: 0;
}
/* The card inside the modal is the real card — no clipping, full rounded corners */
.card-edit-body > .card {
  margin: 0;
  border-left: none !important;
}
/* Modal card header buttons: [trash] [X] at top-right, X rightmost */
.card-edit-body > .card .card-delete-btn {
  right: 52px; /* make room for the close button */
}
.card-modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  font-size: 22px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  z-index: 20;
  transition: opacity 0.2s, transform 0.2s;
}
.card-modal-close-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* ============================================================
   ADD CARD FAB BUTTON
   ============================================================ */
/* Sits in the fab-left stack directly above Settings (.fab-left-up slot);
   only the brand coloring differs from the standard grey fab-left */
#add-card-fab {
  background: var(--brand, #3b82f6);
  color: #fff;
  font-weight: 900;
  font-size: 24px;
  z-index: 1000;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.15),
    inset 0 0 0 1.5px rgba(255,255,255,0.3),
    inset 0 2px 6px rgba(255,255,255,0.4);
}
#add-card-fab:hover {
  background: var(--brand, #3b82f6);
  transform: scale(1.1);
}

/* ============================================================
   DEVICE LAYOUT MODE PICKER (mobile / tablet / desktop profiles)
   ============================================================ */
.device-mode-toggle {
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  padding: 0;
}
.device-mode-toggle:hover {
  color: var(--brand);
  transform: scale(1.1);
}
/* Shared icon markup (same SVGs as the bubble options) sized for the 30px button */
.device-mode-toggle svg {
  width: 20px;
  height: 20px;
}

.device-mode-bubbles {
  position: fixed;
  display: flex;
  flex-direction: row;
  gap: 8px;
  z-index: 10000;
  transform: translateX(-50%);
}
.device-mode-option {
  width: 40px;
  height: 40px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(10px);
}
.device-mode-bubbles.open .device-mode-option {
  animation: deviceBubbleIn 0.2s ease forwards;
}
.device-mode-bubbles.closing .device-mode-option {
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.15s ease;
}
@keyframes deviceBubbleIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.device-mode-option:hover {
  border-color: var(--brand);
  transform: scale(1.1);
}
.device-mode-option.active {
  border-color: var(--brand);
  background: rgba(44, 123, 229, 0.1);
}
.device-mode-option svg {
  width: 100%;
  height: 100%;
  color: var(--text);
}
[data-theme="dark"] .device-mode-option {
  border-color: #475569;
  background: var(--card);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .device-mode-option:hover,
[data-theme="dark"] .device-mode-option.active {
  border-color: var(--brand);
}
[data-theme="dark"] .device-mode-option.active {
  background: rgba(59, 130, 246, 0.2);
}

/* Mobile profile: single-column stack — width resize is locked (both sides) */
body[data-device="mobile"] .card-resize-handle-right,
body[data-device="mobile"] .card-resize-handle-left {
  display: none !important;
}

/* ============================================================
   RESPONSIVE CARD CONTENT (Container Queries)
   Single authoritative block — at END of file so it wins the cascade.

   KEY: tracks use minmax(0, 1fr), NOT 1fr. Plain `1fr` means
   minmax(auto, 1fr): a column can never shrink below its content's
   min-width, so long pills used to force the track wider than the card
   and get clipped by overflow:hidden. minmax(0, 1fr) makes every column
   an exact equal fraction of the card — uniform sizes, hard cutoffs.
   ============================================================ */

/* Base (mid-width cards): exactly 2 equal columns */
.reminder-subtitle-container,
.reminder-grid,
.unified-subtasks-group,
.unified-reminders-group,
.unified-copypaste-group,
.copy-paste-subtitle-container,
.list-links {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Items must be allowed to shrink inside their track */
.unified-reminder-item,
.unified-subtask-item,
.unified-copypaste-item,
.reminder-item {
  min-width: 0;
  overflow: hidden;
}

/* Inner text ellipsizes instead of forcing the pill wider */
.unified-reminder-item .reminder-title,
.reminder-item .reminder-title,
.unified-subtask-item a,
.unified-subtask-item span,
.unified-copypaste-item .unified-copypaste-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badges and buttons keep their size — text shrinks, chrome doesn't */
.unified-reminder-item .days-badge,
.reminder-item .days-badge,
.unified-reminder-item .unified-reminder-edit-btns,
.unified-subtask-item .list-item-links-btn,
.unified-subtask-item .list-item-tasks-btn,
.unified-copypaste-item .copy-paste-icon {
  flex-shrink: 0;
}

/* Wide cards: 3 equal columns — threshold high enough that each pill
   keeps ~280px+ so titles remain readable */
@container (min-width: 900px) {
  .reminder-subtitle-container,
  .reminder-grid,
  .unified-subtasks-group,
  .unified-reminders-group,
  .unified-copypaste-group,
  .copy-paste-subtitle-container,
  .list-links {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}
/* Narrow cards: 1 column */
@container (max-width: 430px) {
  .reminder-subtitle-container,
  .reminder-grid,
  .unified-subtasks-group,
  .unified-reminders-group,
  .unified-copypaste-group,
  .copy-paste-subtitle-container,
  .list-links {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }
  .icon-row {
    gap: 12px;
  }
}
/* Very narrow cards: tighten icon gaps only — icon SIZE never changes,
   .icon-row is flex-wrap so icons simply wrap onto more rows */
@container (max-width: 280px) {
  .icon-row {
    gap: 8px;
  }
}

/* ============================================================
   EDIT MODE GRID OVERLAY — visible grid squares behind cards
   ============================================================ */
/* Graph paper grid overlay — --cell-size is set as px by JS applyCellSize() */
.app-main.edit-mode-tiles::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.18) 1px, transparent 1px);
  background-size: calc(var(--cell-size, 36px) + var(--grid-gap, 16px)) calc(var(--cell-size, 36px) + var(--grid-gap, 16px));
  /* Origin: left padding for columns; header bottom + gap for rows.
     Both variables set by applyCellSize() so lines sit exactly on cell edges. */
  background-position: var(--grid-pad-left, 16px) var(--grid-origin-y, 0px);
  background-attachment: local;
}
[data-theme="dark"] .app-main.edit-mode-tiles::before {
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.1) 1px, transparent 1px);
}

/* Drag ghost — grid child, uses gridColumn/gridRow for placement */
.grid-drag-ghost {
  background: rgba(59, 130, 246, 0.15);
  border: 2px dashed rgba(59, 130, 246, 0.5);
  border-radius: 12px;
  pointer-events: none;
  z-index: 5;
}

/* Swap indicator: BOTH cards pulse identically while a swap is armed.
   Uses filter: drop-shadow (not box-shadow) so the glass cards' layered
   box-shadow rules can't override or visually drown the pulse. */
.card-swap-glow {
  animation: cardSwapPulse 0.9s ease-in-out infinite !important;
  z-index: 15;
  position: relative;
}
/* The dragged source card is dimmed to 0.4 while dragging — restore it so
   its glow is clearly visible during an armed swap */
.card.dragging.card-swap-glow {
  opacity: 0.9;
}
@keyframes cardSwapPulse {
  0%, 100% {
    filter:
      drop-shadow(0 0 4px rgba(59, 130, 246, 0.9))
      drop-shadow(0 0 12px rgba(59, 130, 246, 0.5));
  }
  50% {
    filter:
      drop-shadow(0 0 10px rgba(59, 130, 246, 1))
      drop-shadow(0 0 26px rgba(59, 130, 246, 0.75));
  }
}

/* ===== FILE MANAGER MODAL ===== */
.file-manager-modal { position: fixed; inset: 0; z-index: 2100; display: none; align-items: center; justify-content: center; }
.file-manager-modal.active { display: flex; }
.file-manager-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.file-manager-dialog {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  width: 540px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  overflow: hidden;
}
.file-manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.file-manager-header h4 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
.file-manager-close-btn {
  background: none; border: none; cursor: pointer;
  font-size: 22px; color: var(--muted); line-height: 1;
  padding: 4px 8px; border-radius: 6px;
}
.file-manager-close-btn:hover { background: rgba(0,0,0,0.06); color: var(--text); }

/* Storage bar */
.file-manager-storage-bar {
  position: relative;
  height: 28px;
  background: rgba(0,0,0,0.04);
  margin: 0 20px 8px;
  border-radius: 6px;
  overflow: hidden;
}
.file-manager-storage-fill {
  height: 100%;
  background: var(--brand, #3b82f6);
  border-radius: 6px;
  transition: width 0.4s ease;
}
.file-manager-storage-fill.warning { background: #f59e0b; }
.file-manager-storage-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  pointer-events: none;
}

/* Section headers inside file list */
.file-manager-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  margin-bottom: 4px;
}
.file-manager-section-header.orphan-header { color: #ef4444; }
.file-manager-section-group { margin-bottom: 16px; }
.file-manager-delete-all-btn {
  padding: 4px 10px;
  border: 1px solid #ef4444;
  border-radius: 6px;
  background: transparent;
  color: #ef4444;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: none;
  letter-spacing: 0;
}
.file-manager-delete-all-btn:hover { background: #ef4444; color: white; }
.file-manager-delete-all-btn:disabled { opacity: 0.5; cursor: not-allowed; }
[data-theme="dark"] .file-manager-section-header { border-color: rgba(255,255,255,0.06); }

/* File list */
.file-manager-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 16px;
}
.file-manager-loading, .file-manager-empty {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.file-manager-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.15s;
}
.file-manager-row:hover { background: rgba(0,0,0,0.03); }
.file-manager-row.orphan { background: rgba(239, 68, 68, 0.06); }
.file-manager-row.orphan:hover { background: rgba(239, 68, 68, 0.1); }

/* Thumbnails */
.file-manager-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-manager-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.file-manager-thumb.file-icon svg { color: var(--muted); }

/* File info */
.file-manager-info { flex: 1; min-width: 0; }
.file-manager-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-manager-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.file-manager-orphan-tag {
  color: #ef4444;
  font-weight: 600;
}

/* Delete button */
.file-manager-delete-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
  transition: all 0.15s;
}
.file-manager-delete-btn:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.file-manager-delete-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Dark mode */
[data-theme="dark"] .file-manager-dialog { background: #1e293b; }
[data-theme="dark"] .file-manager-header { border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .file-manager-storage-bar { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .file-manager-row:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .file-manager-row.orphan { background: rgba(239, 68, 68, 0.1); }
[data-theme="dark"] .file-manager-row.orphan:hover { background: rgba(239, 68, 68, 0.15); }
[data-theme="dark"] .file-manager-thumb { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .file-manager-close-btn:hover { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .file-manager-delete-btn:hover { background: rgba(239, 68, 68, 0.15); }

/* ============================================================
   EDITOR IMAGE RESIZE
   ============================================================ */

/* Base image styling in all contenteditable editors */
.task-desc-editor img,
.notepad-editor img,
#project-editor img,
#meetings-inline-desc-editor img,
#ideas-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  cursor: pointer;
  display: block;
  margin: 6px 0;
}

/* Images kept in file storage (js/features/rich-text-images.js): dimmed while
   uploading; a quiet frame while the picture loads or if it's unavailable
   (signed out, or deleted in the File Manager) */
img[data-r2-uploading] {
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
img[data-r2-file-id]:not([src]) {
  display: block;
  width: 160px;
  max-width: 100%;
  height: 96px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--muted) 12%, transparent);
  outline: 1px dashed color-mix(in srgb, var(--muted) 45%, transparent);
  outline-offset: -1px;
}

/* Resize wrapper */
.editor-img-resize-wrap {
  display: inline-block;
  position: relative;
  line-height: 0;
  outline: 2px solid var(--brand, #2c7be5);
  outline-offset: 2px;
  border-radius: 6px;
  margin: 6px 0;
}
.editor-img-resize-wrap img {
  display: block;
  border-radius: 6px;
  margin: 0;
  outline: none;
}

/* Corner handles */
.editor-img-resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--brand, #2c7be5);
  border: 2px solid #fff;
  border-radius: 50%;
  z-index: 5;
  box-shadow: 0 0 3px rgba(0,0,0,0.3);
}
.editor-img-resize-handle.nw { top: -5px; left: -5px; cursor: nwse-resize; }
.editor-img-resize-handle.ne { top: -5px; right: -5px; cursor: nesw-resize; }
.editor-img-resize-handle.sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.editor-img-resize-handle.se { bottom: -5px; right: -5px; cursor: nwse-resize; }



/* ============================================================
   TODAY VIEW (header Today button) - js/features/today.js
   Due today & overdue (left) beside Quick Access (right); one column on
   narrow screens. z-index 9990 keeps it under the item bubbles (9999+),
   the calendar (10000), meetings (10001) and the task editor (10010), so
   everything opened from it stacks on top. Glass look: glass.css / glass-fx.css.
   ============================================================ */
.today-modal {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
}
.today-modal[hidden] { display: none; }
/* The edit pencil (z-index 9999) would float over the panel; the calendar
   and other dialogs sit above it anyway */
body:has(> .today-modal:not([hidden])) .wrench-btn { visibility: hidden; }
.today-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.today-dialog {
  position: relative;
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  background: var(--card, #ffffff);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  outline: none;
}
.today-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] .today-header { border-bottom-color: rgba(255, 255, 255, 0.08); }
.today-title-block {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}
.today-title-block h4 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.today-date {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
.today-header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.today-icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.today-icon-btn:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.05);
}
[data-theme="dark"] .today-icon-btn:hover { background: rgba(255, 255, 255, 0.08); }

.today-body {
  overflow-y: auto;
  padding: 20px 24px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
/* Each column is the container the card item grids measure */
.today-column {
  min-width: 0;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.today-column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}
.today-heading.eisenhower-section-heading {
  margin: 0 0 0 4px;
  font-size: 13px;
}
.today-count {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: rgb(44 123 229 / 12%);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.today-count[hidden] { display: none; }
[data-theme="dark"] .today-count { background: rgb(96 165 250 / 16%); color: #93c5fd; }
.today-add-link { margin-left: auto; }
.today-column-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.today-subheading {
  margin: 6px 0 -4px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.today-empty {
  padding: 28px 16px;
  border: 1.5px dashed rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}
[data-theme="dark"] .today-empty { border-color: rgba(255, 255, 255, 0.12); }

/* Busy-time strip (busy-strip.js): Google free/busy for one day. The bar shows
   8 hours at a time and scrolls sideways through the rest (the track is the
   day's hours / 8 screen widths). Desktop Today puts it above the due list;
   the phone Today tab restyles it (mobile-today.css §1). Static: no animation
   (glass-fx.css 11d) */
.today-daystrip[hidden] { display: none; }
.busy-strip {
  --busy-rgb: 99 102 241;
  display: flex; flex-direction: column; gap: 6px;
  margin: 0 0 14px; padding: 10px 12px 12px;
  border: 1px solid rgba(148, 163, 184, 0.28); border-radius: 14px;
  background: rgba(148, 163, 184, 0.06);
  color: var(--text);
}
.busy-strip[hidden] { display: none; }
.busy-strip-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.busy-strip-head-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.busy-strip-title { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.busy-strip-summary { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* ‹ Now › */
.busy-strip-nav { display: inline-flex; align-items: center; gap: 3px; }
.busy-strip-navbtn {
  display: inline-grid; place-items: center;
  min-width: 24px; height: 22px; padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.32); border-radius: 7px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 11.5px; font-weight: 600; line-height: 1;
  cursor: pointer;
}
.busy-strip-navbtn:hover:not(:disabled) { color: var(--text); border-color: rgba(148, 163, 184, 0.6); }
.busy-strip-navbtn:disabled { opacity: 0.35; cursor: default; }
.busy-strip-navbtn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.busy-strip-now-btn { padding: 0 8px; color: var(--brand); }
.busy-strip-now-btn[hidden] { display: none; }
/* The scroller: room above for the now marker, below for the hour labels;
   the side that has more fades out */
.busy-strip-scroll {
  container: busy-scroll / inline-size;
  position: relative;
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  margin: -2px 0 -2px; padding: 5px 0 17px;
  border-radius: 8px;
  cursor: grab;
  outline: none;
}
.busy-strip-scroll::-webkit-scrollbar { display: none; }
.busy-strip-scroll:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.busy-strip-scroll.is-dragging { cursor: grabbing; }
.busy-strip-scroll[data-more="end"] { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent); }
.busy-strip-scroll[data-more="start"] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px); mask-image: linear-gradient(90deg, transparent, #000 16px); }
.busy-strip-scroll[data-more="both"] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent); }
.busy-strip-track {
  position: relative;
  width: calc(var(--span, 3) * 100%);
  height: 22px; margin: 0;
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.16);
  user-select: none; -webkit-user-select: none;
}
.busy-strip-tick {
  position: absolute; top: 0; bottom: 0;
  left: calc(var(--at) * 1%); width: 1px;
  background: rgba(148, 163, 184, 0.45);
}
.busy-strip-tick:first-child { background: transparent; }
.busy-strip-tick.is-half { top: 32%; bottom: 32%; background: rgba(148, 163, 184, 0.3); }
/* The hour reads beside its tick, so the window's first hour is never cut in half */
.busy-strip-hour {
  position: absolute; top: 100%; left: 0;
  margin-top: 4px; transform: translateX(3px);
  font-size: 10px; line-height: 1; color: var(--muted); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* Narrow strips label every other hour */
@container busy-scroll (max-width: 420px) {
  .busy-strip-tick.is-odd .busy-strip-hour { display: none; }
}
.busy-strip-block {
  position: absolute; top: 3px; bottom: 3px;
  left: calc(var(--l) * 1%); width: calc(var(--w) * 1%); min-width: 3px;
  border-radius: 4px;
  background: rgb(var(--busy-rgb) / 78%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 25%);
}
/* A block's own times, on a layer of the block's size above the now line
   (z 1): the range when it fits, else its start (busy-strip.js only adds that
   off the hour), else nothing. Length classes: r-/s- a ≤ 4 characters, b ≤ 7,
   c ≤ 9, d longer */
.busy-strip-block-text {
  container: busy-block / inline-size;
  position: absolute; top: 3px; bottom: 3px; z-index: 2;
  left: calc(var(--l) * 1%); width: calc(var(--w) * 1%); min-width: 3px;
  display: flex; align-items: center; justify-content: flex-start;
  overflow: hidden;
  pointer-events: none;
}
.busy-strip-block-label {
  padding: 0 5px;
  color: #fff; font-size: 10px; font-weight: 600; line-height: 1; white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 1px rgb(0 0 0 / 22%);
  pointer-events: none;
}
.busy-strip-block-range, .busy-strip-block-start { display: none; }
@container busy-block (min-width: 34px) {
  .s-a > .busy-strip-block-start { display: inline; }
  .r-a > .busy-strip-block-range { display: inline; }
  .r-a > .busy-strip-block-start { display: none; }
}
@container busy-block (min-width: 44px) { .s-b > .busy-strip-block-start { display: inline; } }
@container busy-block (min-width: 56px) {
  .r-b > .busy-strip-block-range { display: inline; }
  .r-b > .busy-strip-block-start { display: none; }
}
@container busy-block (min-width: 68px) {
  .r-c > .busy-strip-block-range { display: inline; }
  .r-c > .busy-strip-block-start { display: none; }
}
@container busy-block (min-width: 80px) {
  .r-d > .busy-strip-block-range { display: inline; }
  .r-d > .busy-strip-block-start { display: none; }
}
.busy-strip-now {
  position: absolute; top: -3px; bottom: -3px; z-index: 1;
  left: calc(var(--at) * 1%); width: 2px; margin-left: -1px;
  border-radius: 1px;
  background: var(--danger);
}
.busy-strip-now[hidden] { display: none; }
.busy-strip-allday {
  align-self: flex-start; margin: 0; padding: 2px 9px;
  border-radius: 999px;
  background: rgb(var(--busy-rgb) / 14%);
  font-size: 12px; font-weight: 600;
}
.busy-strip-list { margin: 0; font-size: 13px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.busy-strip-range { white-space: nowrap; }
.busy-strip-next { margin: 0; font-size: 12.5px; color: #047857; }
.busy-strip-next[hidden] { display: none; }
.busy-strip-note { margin: 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.busy-strip-link { padding: 0; border: 0; background: none; color: var(--brand); font: inherit; text-decoration: underline; cursor: pointer; }
.busy-strip-action {
  align-self: flex-start; padding: 5px 12px;
  border: 1px solid var(--brand); border-radius: 8px;
  background: transparent; color: var(--brand);
  font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.busy-strip-action:focus-visible, .busy-strip-dismiss:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* A hint instead of the bar: why busy times can't show (not connected, not
   enabled for the account, no busy permission), its action and a quiet Hide */
.busy-strip.is-hint { gap: 8px; }
.busy-strip-hint { max-width: 60ch; font-size: 12.5px; }
.busy-strip-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.busy-strip-actions .busy-strip-action { align-self: auto; }
.busy-strip-dismiss {
  padding: 5px 10px;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.busy-strip-dismiss:hover { color: var(--text); border-color: rgba(148, 163, 184, 0.4); }
@media (forced-colors: active) {
  .busy-strip-action, .busy-strip-dismiss { border-color: ButtonText; }
}
[data-theme="dark"] .busy-strip { --busy-rgb: 129 140 248; border-color: rgba(148, 163, 184, 0.2); background: rgba(148, 163, 184, 0.05); }
[data-theme="dark"] .busy-strip-track { background: rgba(148, 163, 184, 0.14); }
[data-theme="dark"] .busy-strip-next { color: #34d399; }

/* Tasks: one tinted group per color, red on top (the matrix column look) */
.today-tasks {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.today-color-group.eisenhower-priority-card {
  flex: none;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  gap: 10px;
}
.today-color-label {
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.7;
}
.today-task {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.today-task .eisenhower-task-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.today-task .eisenhower-task-icons { flex-shrink: 0; }

/* Chips: due today, overdue, "subtask due", recurring meeting */
.today-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}
.today-chip.is-today { color: #1d4ed8; background: rgb(59 130 246 / 14%); }
.today-chip.is-overdue { color: #b91c1c; background: rgb(239 68 68 / 15%); }
.today-chip.is-context { color: var(--muted); background: rgb(100 116 139 / 12%); font-weight: 600; }
.today-chip.is-meeting { color: #6d28d9; background: rgb(139 92 246 / 14%); }
[data-theme="dark"] .today-chip.is-today { color: #93c5fd; background: rgb(96 165 250 / 18%); }
[data-theme="dark"] .today-chip.is-overdue { color: #fca5a5; background: rgb(248 113 113 / 18%); }
[data-theme="dark"] .today-chip.is-context { color: #cbd5e1; background: rgb(148 163 184 / 16%); }
[data-theme="dark"] .today-chip.is-meeting { color: #c4b5fd; background: rgb(167 139 250 / 18%); }

/* Only a subtask is due: the task steps back (dashed outline, quieter) and
   its due subtasks below carry the dates */
.today-task-context {
  opacity: 0.8;
  border-style: dashed !important;
}
.today-task-context:hover { opacity: 1; }
/* A pinned parent holds its light still, so the due subtask is what draws the eye */
.today-task-context.eisenhower-task-pinned::before {
  animation: none !important;
  opacity: 0.35 !important;
}

/* Due subtasks hang off their task on a rail in the task's color */
.today-subtasks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 14px;
  padding-left: 12px;
  border-left: 2px solid rgb(var(--priority-rgb, 148 163 184) / 45%);
}
.today-subtask {
  min-height: 38px;
  gap: 8px;
  cursor: pointer;
}
.today-subtask-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.today-subtask .task-subtask-complete-btn:hover { color: #16a34a; }

/* Meetings today */
.today-meetings {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.today-meeting {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgb(139 92 246 / 28%);
  border-radius: 14px;
  background: rgb(139 92 246 / 8%);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.today-meeting:hover {
  background: rgb(139 92 246 / 14%);
  transform: translateY(-1px);
}
.today-meeting-icon { display: flex; flex-shrink: 0; color: #7c3aed; }
.today-meeting-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.today-meeting-chevron { display: flex; flex-shrink: 0; color: var(--muted); }
[data-theme="dark"] .today-meeting-icon { color: #c4b5fd; }

/* Reminders and Quick Access are the real card items in their card groups;
   columns follow the panel width (after the card container queries above) */
.today-modal .today-reminders,
.today-qa .unified-reminders-group,
.today-qa .unified-subtasks-group,
.today-qa .unified-copypaste-group {
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)) !important;
  gap: 10px !important;
}
.today-qa .unified-icons-group { margin-bottom: 0; }
.today-quick-link .unified-subtask-left > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
/* The card rule ".unified-subtask-item span { flex: 1 }" would stretch the glyph */
.today-quick-link .today-quick-link-icon {
  flex: 0 0 auto;
  display: flex;
  margin-right: 4px;
  color: var(--muted);
}

@media (max-width: 860px) {
  .today-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 16px 16px 24px;
  }
}
@media (max-width: 520px) {
  .today-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 18px;
  }
  .today-header { padding: 14px 16px 12px; }
}
