/* ===== Reset & Variables ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== Sleek dark creator-dashboard theme =====
   The UI is token-driven: --gold* is the vivid accent ramp (formerly gold,
   now electric violet), --parchment* are raised surfaces. */
:root {
  --bg-primary: #0a0c11;
  --bg-secondary: #12151d;
  --bg-tertiary: #1a1e29;
  --bg-hover: #222736;
  --parchment: #161a23;
  --parchment-light: #1f2430;
  --text-primary: #eef1f7;
  --text-secondary: #9aa3b8;
  --text-muted: #5e6678;
  --border-color: #232838;
  --border-glow: #394155;
  --gold: #8b5cf6;
  --gold-bright: #a78bfa;
  --gold-dim: #5b3fb0;
  --stone: #5e6678;
  --stone-light: #7a8296;
  --accent: #8b5cf6;
  --color-1: #f43f5e;
  --color-2: #8b5cf6;
  --color-3: #10b981;
  --modal-backdrop: rgba(5, 7, 12, 0.72);
  --shadow-modal: 0 24px 64px rgba(0,0,0,0.6);
  --avatar-shadow: rgba(0,0,0,0.6);
  --radius: 10px;
  --radius-lg: 16px;
  --font-medieval: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

:root[data-theme="light"] {
  --bg-primary: #f6f7fb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f3f9;
  --bg-hover: #e8ebf3;
  --parchment: #ffffff;
  --parchment-light: #f1f3f9;
  --text-primary: #161a23;
  --text-secondary: #56607a;
  --text-muted: #8a93a6;
  --border-color: #e4e8f0;
  --border-glow: #cbd3e2;
  --gold: #7c3aed;
  --gold-bright: #8b5cf6;
  --gold-dim: #c4b5fd;
  --stone: #8a93a6;
  --stone-light: #a8b0c0;
  --accent: #7c3aed;
  --color-1: #e11d48;
  --color-2: #7c3aed;
  --color-3: #059669;
  --modal-backdrop: rgba(20, 24, 35, 0.4);
  --shadow-modal: 0 24px 64px rgba(30, 35, 50, 0.18);
  --avatar-shadow: rgba(30, 35, 50, 0.25);
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 20px 16px;
  max-width: 960px;
  margin: 0 auto;
}

/* ===== Sync Indicator ===== */
.sync-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  padding: 4px 0 2px;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.4s, box-shadow 0.4s;
}

.sync-indicator.synced .sync-dot {
  background: #3fb950;
  box-shadow: 0 0 6px rgba(63,185,80,0.5);
}

.sync-indicator.error .sync-dot {
  background: #da3633;
  box-shadow: 0 0 6px rgba(218,54,51,0.4);
}

.sync-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-weight: 600;
}

.sync-indicator.synced .sync-label { color: #3fb950; }
.sync-indicator.error .sync-label { color: #da3633; }

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  font-family: var(--font-medieval);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(212,168,67,0.2);
  letter-spacing: 1px;
}

.settings-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.72rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.3px;
}
.settings-btn:hover { color: var(--gold); border-color: var(--gold-dim); background: var(--bg-tertiary); }

.theme-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.theme-btn:hover { color: var(--gold); border-color: var(--gold-dim); background: var(--bg-tertiary); }
.theme-btn .theme-icon-light { display: none; }
:root[data-theme="light"] .theme-btn .theme-icon-light { display: inline; }
:root[data-theme="light"] .theme-btn .theme-icon-dark { display: none; }

.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.nav-btn:hover { border-color: var(--border-glow); color: var(--text-secondary); }

.month-label {
  font-family: var(--font-medieval);
  font-size: 1.15rem;
  font-weight: 400;
  min-width: 170px;
  text-align: center;
  color: var(--text-primary);
}

/* ===== Quest Path ===== */
.quest-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 24px 14px;
  margin-bottom: 20px;
}

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

.quest-title {
  font-family: var(--font-medieval);
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.gold-counter {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-medieval);
  font-size: 0.95rem;
  color: var(--gold);
}

.coin-icon {
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 38% 32%, var(--gold-bright), var(--gold), var(--gold-dim));
  border-radius: 50%;
  border: 2px solid var(--gold-dim);
  display: inline-block;
  box-shadow: 0 0 10px rgba(212,168,67,0.3);
}

.quest-path {
  position: relative;
  height: 70px;
  display: flex;
  align-items: center;
}

.path-line {
  position: absolute;
  top: 50%;
  left: 20px;
  right: 20px;
  height: 3px;
  background: var(--border-color);
  border-radius: 2px;
  transform: translateY(-50%);
}

.path-line-fill {
  position: absolute;
  top: 50%;
  left: 20px;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 2px;
  transform: translateY(-50%);
  transition: width 0.8s ease;
  width: 0;
  box-shadow: 0 0 10px rgba(212,168,67,0.25);
}

.checkpoints {
  position: relative;
  display: flex;
  justify-content: space-between;
  width: 100%;
  z-index: 2;
  padding: 0 8px;
}

.checkpoint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
}

.checkpoint-node {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--stone);
  transition: all 0.5s;
}

.checkpoint.completed .checkpoint-node {
  border-color: var(--gold);
  background: var(--gold-dim);
  box-shadow: 0 0 14px rgba(212,168,67,0.4);
}

.checkpoint-label {
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.checkpoint.completed .checkpoint-label {
  color: var(--text-secondary);
}

.checkpoint-coin {
  position: absolute;
  top: -16px;
  width: 13px;
  height: 13px;
  background: radial-gradient(circle at 38% 32%, var(--gold-bright), var(--gold));
  border-radius: 50%;
  border: 1.5px solid var(--gold-dim);
  box-shadow: 0 0 8px rgba(212,168,67,0.5);
  display: none;
}
.checkpoint.has-gold .checkpoint-coin { display: block; }

/* Quest Lore */
.quest-lore {
  margin-top: 14px;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-style: italic;
  text-align: center;
  padding: 0 8px;
}

.quest-lore strong {
  color: var(--gold);
  font-style: normal;
  font-weight: 600;
}

.quest-lore-name {
  color: #6bba62;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* Avatar — clean SVG */
.quest-avatar {
  position: absolute;
  z-index: 3;
  transition: left 0.8s cubic-bezier(0.25, 1, 0.5, 1);
  left: 8px;
  top: 2px;
  pointer-events: none;
}

.quest-avatar svg {
  width: 28px;
  height: 36px;
  filter: drop-shadow(0 2px 6px var(--avatar-shadow));
}

/* ===== Legend ===== */
.legend-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 14px;
  gap: 12px;
}

.legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.edit-endeavors-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--gold);
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.edit-endeavors-btn:hover {
  border-color: var(--gold-dim);
  background: color-mix(in srgb, var(--gold) 8%, var(--bg-tertiary));
  box-shadow: 0 0 12px rgba(212,168,67,0.1);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== Calendar Grid ===== */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 3px;
}

.weekday {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 0;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

/* ===== Day Cell ===== */
.day-cell {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  min-height: 95px;
  padding: 7px;
  position: relative;
  cursor: pointer;
  transition: all 0.15s;
}
.day-cell:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-glow);
}
.day-cell.empty {
  background: var(--bg-primary);
  border-color: transparent;
  cursor: default;
  opacity: 0.3;
}
.day-cell.today {
  border-color: var(--gold-dim);
  box-shadow: inset 0 0 0 1px rgba(212,168,67,0.1);
}
.day-cell.drag-over {
  background: var(--bg-hover);
  border-color: var(--gold);
  box-shadow: inset 0 0 12px rgba(212,168,67,0.1);
}

.day-number {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 5px;
}
.day-cell.today .day-number { color: var(--gold); }

/* Empty day hint */
.day-hint {
  font-size: 0.5rem;
  color: var(--text-muted);
  opacity: 0.5;
  text-align: center;
  margin-top: 12px;
  line-height: 1.3;
}

/* ===== Day Card ===== */
.day-card {
  border-radius: 5px;
  padding: 6px 8px;
  background: var(--parchment);
  border-left: 3px solid var(--type-color, var(--border-color));
  cursor: grab;
  transition: opacity 0.15s, transform 0.15s;
}
.day-card:active { cursor: grabbing; }
.day-card.dragging { opacity: 0.3; transform: scale(0.95); }

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

.content-type-badge {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--type-color, var(--text-secondary));
}

.done-check {
  width: 13px;
  height: 13px;
  accent-color: var(--gold);
  cursor: pointer;
}

.card-title {
  font-size: 0.65rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  line-height: 1.3;
}

.platform-tags {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.48rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tag-youtube { background: #ff0033; color: #fff; }
.tag-instagram { background: #c13584; color: #fff; }
.tag-tiktok { background: #25f4ee; color: #000; }
.tag-twitch { background: #6441a5; color: #fff; }

/* ===== Month Overview (replaces the old quest bar) ===== */
.overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.overview-stats { display: flex; gap: 28px; }
.overview-stat { display: flex; flex-direction: column; gap: 2px; }
.overview-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.overview-stat:nth-child(3) .overview-num { color: var(--gold); }
.overview-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.overview-weeks { display: flex; gap: 6px; align-items: center; }
.ov-week {
  width: 26px;
  height: 8px;
  border-radius: 99px;
  background: var(--bg-hover);
  position: relative;
  overflow: hidden;
}
.ov-week-fill {
  position: absolute;
  inset: 0;
  width: 0;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transition: width 0.6s ease;
}
.ov-week.full .ov-week-fill { background: linear-gradient(90deg, var(--gold), var(--gold-bright)); }

/* ===== Channels View ===== */
.channels-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.channels-title { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.4px; }
.channels-subtitle { font-size: 0.78rem; color: var(--text-secondary); margin-top: 3px; max-width: 60ch; line-height: 1.5; }
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.channel-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  border-top: 3px solid var(--chan-color, var(--gold));
}
.channel-card:hover { border-color: var(--border-glow); transform: translateY(-2px); }
.channel-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.channel-badge {
  font-size: 0.58rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px;
  padding: 3px 8px; border-radius: 99px; color: #fff; background: var(--chan-color, var(--gold));
}
.channel-name { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.channel-handle { font-size: 0.7rem; color: var(--text-muted); }
.channel-metrics { display: flex; gap: 20px; }
.channel-metric { display: flex; flex-direction: column; gap: 2px; }
.channel-metric-num { font-size: 1.25rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.channel-metric-label { font-size: 0.6rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); }
.channel-delta { font-size: 0.66rem; font-weight: 700; margin-left: 4px; }
.channel-delta.up { color: #3fb950; }
.channel-delta.down { color: #da3633; }
.channel-delta.flat { color: var(--text-muted); }
.channel-updated { font-size: 0.6rem; color: var(--text-muted); margin-top: 12px; }
.channel-syncing { font-size: 0.6rem; color: var(--gold); margin-top: 12px; }

.channels-empty {
  background: var(--bg-secondary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  color: var(--text-secondary);
}
.channels-empty-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }

.api-note {
  margin-top: 22px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.api-note ul { margin: 8px 0 0; padding-left: 18px; }
.api-note li { margin-bottom: 4px; }
.api-note b { color: var(--text-primary); }

.field-hint { font-size: 0.68rem; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }

/* Done state */
.day-card.done { opacity: 0.45; }
.day-card.done .card-title { text-decoration: line-through; }

/* ===== Tip Banner ===== */
.tip-banner {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tip-banner-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.tip-banner-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  margin-left: auto;
  padding: 0 2px;
  flex-shrink: 0;
}
.tip-banner-close:hover { color: var(--text-primary); }

.tip-banner strong {
  color: var(--gold);
  font-weight: 600;
}

/* ===== Modal (shared) ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: var(--shadow-modal);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text-primary); }

.modal-date, .modal-heading {
  font-family: var(--font-medieval);
  font-size: 1.1rem;
  font-weight: 400;
  margin-bottom: 20px;
  color: var(--gold);
}

.field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 16px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.type-selector {
  display: flex;
  gap: 6px;
}

.type-btn {
  flex: 1;
  padding: 9px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.type-btn:hover { border-color: var(--type-color); color: var(--type-color); }
.type-btn.active {
  border-color: var(--type-color);
  color: var(--type-color);
  background: color-mix(in srgb, var(--type-color) 8%, var(--bg-tertiary));
  box-shadow: 0 0 12px color-mix(in srgb, var(--type-color) 15%, transparent);
}

.field-input, .field-textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}
.field-input:focus, .field-textarea:focus { border-color: var(--gold-dim); }
.field-textarea { resize: vertical; }

.platform-checks {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-primary);
  cursor: pointer;
}
.check-label input[type="checkbox"] {
  accent-color: var(--gold);
  width: 15px;
  height: 15px;
}

.done-label {
  margin-top: 18px;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.3px;
}
.btn:hover { filter: brightness(1.1); }
.btn-save {
  background: #238636;
  color: #fff;
}
.btn-delete {
  background: var(--bg-tertiary);
  color: #da3633;
  border: 1px solid var(--border-color);
}
.btn-delete:hover { background: color-mix(in srgb, #da3633 14%, var(--bg-tertiary)); }

/* ===== Settings Modal ===== */
.settings-modal {
  max-width: 520px;
}

.endeavor-card {
  margin-bottom: 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

.endeavor-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--endeavor-color, #444) 8%, var(--bg-tertiary));
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.endeavor-card-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--endeavor-color, var(--border-color));
  border-radius: 2px 0 0 0;
}

.endeavor-number {
  font-family: var(--font-medieval);
  font-size: 1.1rem;
  color: var(--endeavor-color, var(--text-muted));
  min-width: 20px;
  text-align: center;
  opacity: 0.7;
}

.endeavor-icon-btn {
  background: var(--parchment);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}
.endeavor-icon-btn:hover { border-color: var(--gold-dim); transform: scale(1.1); }

.endeavor-name {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  transition: all 0.15s;
}
.endeavor-name:hover { border-color: var(--border-color); background: var(--parchment); }
.endeavor-name:focus { border-color: var(--gold-dim); background: var(--parchment); }

.endeavor-color {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s;
}
.endeavor-color:hover { transform: scale(1.15); }

.endeavor-card-body {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.endeavor-platforms {
  display: flex;
  gap: 8px;
  font-size: 0.75rem;
}

.endeavor-platforms label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.endeavor-platforms label:hover { border-color: var(--border-color); background: var(--parchment); }

.endeavor-platforms input {
  accent-color: var(--gold);
  width: 13px;
  height: 13px;
}

.endeavor-preview {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.icon-picker {
  display: none;
  flex-wrap: wrap;
  gap: 5px;
  padding: 10px 16px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}
.icon-picker.open { display: flex; }

.icon-option {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.15s;
}
.icon-option:hover { border-color: var(--gold); transform: scale(1.1); }
.icon-option.selected { border-color: var(--gold); background: var(--parchment-light); box-shadow: 0 0 8px rgba(212,168,67,0.2); }

/* ===== Login Screen ===== */
.hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 44px 36px 36px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-modal);
}

.login-crest {
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 12px;
  text-shadow: 0 0 14px rgba(212,168,67,0.35);
}

.login-title {
  font-family: var(--font-medieval);
  font-size: 2.1rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  margin: 0 0 6px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0 0 22px;
}

.login-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-glow), transparent);
  margin: 0 auto 24px;
  width: 70%;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 18px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-google:hover {
  border-color: var(--gold);
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.login-error {
  color: #da3633;
  font-size: 0.8rem;
  margin: 10px 0 0;
  min-height: 1.1em;
}

.login-or {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 18px 0 12px;
  position: relative;
}
.login-or::before,
.login-or::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 28%;
  height: 1px;
  background: var(--border-color);
}
.login-or::before { left: 4%; }
.login-or::after { right: 4%; }

.btn-readonly {
  display: inline-block;
  padding: 9px 16px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-readonly:hover {
  color: var(--gold);
  border-color: var(--gold-dim);
}

/* ===== Read-only banner / sign out ===== */
.readonly-banner {
  background: rgba(212, 168, 67, 0.1);
  border: 1px solid var(--gold-dim);
  color: var(--text-primary);
  font-size: 0.78rem;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius);
  margin: 6px 0 14px;
}
.readonly-banner a {
  color: var(--gold);
  text-decoration: underline;
  font-weight: 600;
}

.logout-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 5px 11px;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s;
  margin-left: 4px;
}
.logout-btn:hover {
  color: var(--text-primary);
  border-color: var(--gold-dim);
}
.logout-btn:disabled { opacity: 0.5; cursor: wait; }

body.read-only .edit-only { display: none !important; }
body.read-only .day-cell { cursor: default; }

/* ===== View Tabs ===== */
.view-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.view-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 18px;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  letter-spacing: 0.3px;
  font-family: var(--font-body);
}
.view-tab:hover { color: var(--text-primary); }
.view-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.view { display: none; }
.view.active { display: block; }

/* Hide month nav on library view */
body.view-library #month-nav { display: none; }

/* ===== Library ===== */
.library-header {
  margin-bottom: 16px;
}

.library-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.library-title {
  font-family: var(--font-medieval);
  font-size: 1.4rem;
  color: var(--gold);
  font-weight: 400;
  letter-spacing: 1px;
}

.library-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

#library-add-btn { font-size: 0.78rem; padding: 7px 14px; }

.library-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.filter-search { flex: 1; min-width: 180px; }

.filter-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 600;
}

.filter-select,
.filter-input {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-family: var(--font-body);
}
.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: var(--gold-dim);
}

.library-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.library-group-heading {
  font-family: var(--font-medieval);
  font-size: 1.05rem;
  color: var(--gold);
  font-weight: 400;
  letter-spacing: 0.8px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.library-group-name { flex: 1; }

.library-group-count {
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}

.library-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.library-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
}
.library-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-1px);
}

.library-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.library-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.library-type-badge {
  font-size: 0.6rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.library-type-badge.type-reel { color: #e879f9; border-color: #6b3a82; }
.library-type-badge.type-carousel { color: #fbbf24; border-color: #7a5a1a; }
.library-type-badge.type-profile { color: #7aa8e0; border-color: #2d4a6e; }
.library-type-badge.type-story { color: #fb7185; border-color: #6e2a3a; }
.library-type-badge.type-video { color: #f87171; border-color: #6e2a2a; }

.library-platform {
  font-size: 0.62rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.library-platform.platform-tiktok { background: #000; color: #fff; }
.library-platform.platform-instagram {
  background: linear-gradient(135deg, #f09433, #e6683c 30%, #dc2743 60%, #bc1888);
  color: #fff;
}
.library-platform.platform-youtube { background: #cc0000; color: #fff; }

.library-card-actions {
  display: flex;
  gap: 6px;
}

.library-icon-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.library-icon-btn:hover { color: var(--gold); border-color: var(--gold-dim); }

body.read-only .library-icon-btn { display: none; }

.library-card-title {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.library-card-category {
  font-size: 0.7rem;
  color: var(--gold);
  letter-spacing: 0.4px;
  font-weight: 600;
  text-transform: uppercase;
}

.library-card-doability {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.doability-tag {
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.doability-tag.tag-solo { color: #5fb878; border-color: #2d5a35; }
.doability-tag.tag-plusone { color: #d4a843; border-color: #6a531e; }
.doability-tag.tag-ai { color: #7aa8e0; border-color: #2d4a6e; }

.library-card-notes {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
}

.library-card-link {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-decoration: none;
  word-break: break-all;
  display: inline-block;
}
.library-card-link:hover { color: var(--gold); text-decoration: underline; }

.library-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.library-empty-hint { font-size: 0.82rem; margin-top: 8px; }

/* ===== Library Modal ===== */
.field-optional {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

.lib-platform-badge {
  margin-top: -6px;
  margin-bottom: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  min-height: 16px;
}
.lib-platform-badge.detected { color: var(--gold); }

.doability-checks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.doability-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  transition: all 0.2s;
  user-select: none;
}
.doability-chip:hover { border-color: var(--gold-dim); color: var(--text-primary); }
.doability-chip input { display: none; }
.doability-chip:has(input:checked) {
  background: var(--gold-dim);
  color: var(--text-primary);
  border-color: var(--gold);
}
.doability-chip-icon { font-size: 1rem; }

/* ===== Library: view switcher (Cards/Table/Feed) ===== */
.library-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.78rem;
  letter-spacing: 0.3px;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--gold-dim); }

.library-view-switcher {
  display: inline-flex;
  gap: 2px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 3px;
  margin-top: 10px;
}

.library-view-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: var(--font-body);
  letter-spacing: 0.3px;
  transition: all 0.15s;
}
.library-view-btn:hover { color: var(--text-primary); }
.library-view-btn.active {
  background: var(--bg-primary);
  color: var(--gold);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ===== Library: Table view ===== */
.library-table {
  overflow-x: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.library-table-el {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.library-table-el th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.65rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.library-table-el td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-secondary);
}

.library-table-el tbody tr:hover {
  background: var(--bg-tertiary);
}

.library-table-el tbody tr:last-child td { border-bottom: none; }

.cell-title { color: var(--text-primary); font-weight: 600; max-width: 180px; }
.cell-category {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--gold);
  background: var(--bg-tertiary);
  padding: 3px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  font-weight: 600;
}
.cell-doability { font-size: 1rem; white-space: nowrap; }
.cell-hook { max-width: 220px; font-size: 0.78rem; }
.cell-link { font-size: 0.72rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-link a { color: var(--text-muted); text-decoration: none; }
.cell-link a:hover { color: var(--gold); text-decoration: underline; }
.cell-muted { color: var(--text-muted); }
.cell-actions { text-align: right; }

/* ===== Library: Feed (Instagram-style 3-col grid) ===== */
.library-feed {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.feed-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feed-section-heading {
  font-family: var(--font-medieval);
  font-size: 1.05rem;
  color: var(--gold);
  font-weight: 400;
  letter-spacing: 0.8px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 6px;
}

.feed-section-count {
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.feed-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  background: hsl(var(--tile-hue, 200), 40%, 25%);
  padding: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}
:root[data-theme="light"] .feed-tile {
  background: hsl(var(--tile-hue, 200), 50%, 75%);
}

.feed-tile:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 1;
}

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

.feed-tile.no-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    hsl(var(--tile-hue, 200), 45%, 30%),
    hsl(calc(var(--tile-hue, 200) + 40), 40%, 22%));
}
:root[data-theme="light"] .feed-tile.no-thumb::before {
  background: linear-gradient(135deg,
    hsl(var(--tile-hue, 200), 55%, 78%),
    hsl(calc(var(--tile-hue, 200) + 40), 50%, 72%));
}

.feed-tile-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 50%);
  color: #fff;
  font-size: 0.7rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 0.2s;
}

.feed-tile:hover .feed-tile-overlay,
.feed-tile.no-thumb .feed-tile-overlay {
  opacity: 1;
}

.feed-tile-type {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.75rem;
  opacity: 1;
}

.feed-tile-handle {
  font-weight: 600;
  word-break: break-word;
  line-height: 1.2;
}

/* ===== Bulk paste modal ===== */
.bulk-status {
  margin: 10px 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  min-height: 18px;
}

/* ===== Library: field row (Type + img-index side-by-side) ===== */
.field-row {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}
.field-col {
  flex: 1;
  min-width: 0;
}

/* ===== Library: collapsible review section ===== */
.review-section {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  margin-bottom: 12px;
  padding: 0;
}

.review-summary {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  letter-spacing: 0.4px;
  font-weight: 600;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  list-style: none;
}
.review-summary::-webkit-details-marker { display: none; }
.review-summary::marker { display: none; }
.review-summary:hover { color: var(--gold); }

.review-toggle-icon {
  transition: transform 0.2s;
  font-size: 0.7rem;
}
.review-section[open] .review-toggle-icon { transform: rotate(90deg); }

.review-count {
  margin-left: auto;
  font-size: 0.65rem;
  color: var(--gold);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.3px;
}

.review-fields {
  padding: 4px 12px 12px;
  border-top: 1px solid var(--border-color);
}
.review-fields .field-label:first-child { margin-top: 8px; }

/* ===== Library card: review summary ===== */
.library-card-review {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  font-size: 0.75rem;
}

.library-card-review-row {
  display: flex;
  gap: 8px;
  line-height: 1.4;
}

.library-card-review-label {
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-size: 0.6rem;
  min-width: 56px;
  flex-shrink: 0;
  padding-top: 2px;
}

.library-card-review-value {
  color: var(--text-secondary);
  flex: 1;
  word-break: break-word;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .day-cell { min-height: 72px; padding: 5px; }
  .content-type-badge { font-size: 0.48rem; }
  .card-title { font-size: 0.55rem; }
  .platform-tags { display: none; }
  .modal { padding: 20px; }
  .quest-section { padding: 14px 16px 10px; }
  .quest-avatar svg { width: 22px; height: 28px; }
  .tip-banner { font-size: 0.72rem; }
  .day-hint { display: none; }
  .legend-section { flex-direction: column; align-items: flex-start; }
  .edit-endeavors-btn { align-self: stretch; text-align: center; }
  .library-group-grid { grid-template-columns: 1fr; }
  .view-tab { padding: 10px 12px; font-size: 0.78rem; }
  .field-row { flex-direction: column; gap: 0; }
  .library-view-btn { padding: 6px 8px; font-size: 0.68rem; }
  .feed-grid { gap: 2px; }
  .feed-tile-handle { font-size: 0.6rem; }
}
