/* ============ DESIGN TOKENS ============ */
:root {
  /* color */
  --bg: #FAF6F0;
  --surface: #FFFFFF;
  --border: #EFE5D8;
  --text: #2F2B26;
  --muted: #8C8377;
  --accent: #E2725B;
  --accent-dark: #C85A44;
  --accent-soft: #FBEEE7;
  --green: #4C9A62;
  --green-soft: #EAF4ED;
  --amber: #D9913B;
  --amber-soft: #FBF3E4;
  --rose: #C94F4F;
  --rose-soft: #F9ECEC;
  --sage: #7A9471;
  --sage-soft: #F0F4EC;
  --dot-idle: #C9C0B4;
  --line: #E5DCCC;
  /* shape & size */
  --radius: 18px;
  --radius-lg: 26px;
  --radius-pill: 999px;
  --card-h: 430px;
  --container: 1152px;
  /* elevation */
  --shadow-card: 0 20px 45px -22px rgba(47, 43, 38, 0.35);
  --shadow-soft: 0 10px 24px -10px rgba(47, 43, 38, 0.45);
  --shadow-pop: 0 16px 40px -18px rgba(47, 43, 38, 0.45);
  /* type */
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* ============ BASE ============ */
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; padding-top: 24px; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
[hidden] { display: none !important; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.stack { display: flex; flex-direction: column; gap: 20px; padding-bottom: 40px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============ UPCOMING TICKER (fixed top) ============ */
.ticker {
  position: fixed; top: 0; left: 0; right: 0; z-index: 56; height: 24px;
  background: var(--text); color: var(--bg); overflow: hidden;
  display: flex; align-items: center;
}
.ticker-inner { display: flex; width: max-content; animation: ticker-move 45s linear infinite; }
.ticker:hover .ticker-inner { animation-play-state: paused; }
.ticker-set { display: flex; align-items: center; gap: 36px; padding-right: 36px; }
.ticker-item { font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.ticker-sep { width: 3px; height: 3px; border-radius: var(--radius-pill); background: currentColor; opacity: 0.55; flex-shrink: 0; }
@keyframes ticker-move { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .ticker-inner { animation: none; }
  .ticker { overflow-x: auto; }
}

/* ============ LOGO BUBBLE (fixed, all pages) ============ */
.logo-bubble {
  position: fixed; top: 40px; left: 16px; z-index: 50;
  width: 56px; height: 56px; border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #E2725B 0%, #E8A87C 100%);
  border: 3px solid #FFFFFF; box-shadow: var(--shadow-soft);
  text-decoration: none; transition: transform 0.15s ease;
}
.logo-bubble:hover { transform: scale(1.05); }
.logo-bubble .wordmark { font-weight: 800; font-size: 13.5px; letter-spacing: -0.3px; color: #fff; user-select: none; }
.logo-bubble svg { position: absolute; }
.logo-bubble .monkey { top: 5px; right: 5px; }
.logo-bubble .fish { bottom: 6px; left: 7px; }

/* ============ HOMEPAGE ============ */
.view-home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 0;
  background: #F0F8F0;
}
.strip-viewport {
  width: 100%;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}
.strip-viewport:active { cursor: grabbing; }
.strip-inner {
  display: flex;
  width: max-content;
  animation: marquee 55s linear infinite;
  transition: transform 0.3s ease-out;
}
.strip-viewport:hover .strip-inner, .strip-viewport:focus-within .strip-inner { 
  animation-play-state: paused; 
}
.strip-set { display: flex; gap: 24px; padding-right: 24px; }
.photo-card {
  flex-shrink: 0;
  width: 280px;
  height: 350px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 4px solid #fff;
  box-shadow: var(--shadow-card);
  background: #fff;
  transition: transform 0.3s ease;
}
.photo-card:hover {
  transform: scale(1.02);
}
.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .strip-inner { animation: none; }
  .strip-viewport { overflow-x: auto; }
}
.home-menu { display: flex; justify-content: center; margin-top: 40px; padding: 0 24px; }
.btn-dark {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 28px; border-radius: var(--radius-pill); border: none;
  background: var(--text); color: var(--bg); font-weight: 700; font-size: 16px;
  text-decoration: none; box-shadow: 0 18px 40px -18px rgba(47, 43, 38, 0.5);
  transition: transform 0.15s ease;
}
.btn-dark:hover { transform: translateY(-2px); }

/* ============ DASHBOARD ============ */
.dash-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 20px 24px 20px 72px;
}
.dash-header .left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dash-title { font-size: 18px; font-weight: 700; margin: 0; }
.link-btn { background: none; border: none; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: underline; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: #fff; color: var(--text);
  font-size: 13px; font-weight: 600; text-decoration: none;
}

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.fixed-card { display: flex; flex-direction: column; gap: 12px; height: var(--card-h); }
.scroll-area { flex: 1; overflow-y: auto; }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-head h2 { font-size: 14px; font-weight: 700; margin: 0; }

/* ============ TASKS ============ */
.tasks-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.btn-accent {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-pill); border: none;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
  transition: transform 0.15s ease;
}
.btn-accent:hover { transform: translateY(-2px); }
.task-form { background: var(--bg); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.task-form input[type="text"] {
  width: 100%; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: #fff; outline: none; font-size: 14px;
}
.form-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-row .prio-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.prio-btn {
  padding: 6px 12px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border); background: #fff; color: var(--muted);
}
.prio-btn[aria-pressed="true"].p-high { border-color: var(--rose); background: var(--rose-soft); color: var(--rose); }
.prio-btn[aria-pressed="true"].p-medium { border-color: var(--amber); background: var(--amber-soft); color: var(--amber); }
.prio-btn[aria-pressed="true"].p-low { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.date-wrap { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.date-wrap input { border: none; background: transparent; font-size: 12px; outline: none; }
.btn-green {
  margin-left: auto; padding: 8px 16px; border-radius: var(--radius-pill); border: none;
  background: var(--green); color: #fff; font-size: 12px; font-weight: 600;
}
.btn-green:disabled { opacity: 0.4; cursor: not-allowed; }

.task-list { list-style: none; margin: 8px 0 0; padding: 0; }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.task .check {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: var(--radius-pill);
  border: 2px solid #D8CFC0; background: #fff; padding: 0;
  display: flex; align-items: center; justify-content: center; color: transparent;
  transition: transform 0.15s ease;
}
.task .check:hover { transform: scale(1.05); }
.task.done .check { background: var(--green); border-color: var(--green); color: #fff; }
.task-body { flex: 1; min-width: 0; }
.task-title { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.3; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.badge { font-size: 11px; font-weight: 600; border-radius: var(--radius-pill); padding: 2px 8px; }
.badge-high { background: var(--rose-soft); color: var(--rose); }
.badge-medium { background: var(--amber-soft); color: var(--amber); }
.badge-low { background: var(--green-soft); color: var(--green); }
.badge-due { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); color: var(--muted); }
.badge-source { background: var(--bg); color: var(--muted); }
.badge-source.auto { background: var(--accent-soft); color: var(--accent-dark); }
.del-btn {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: var(--radius-pill);
  border: none; background: none; color: var(--muted); opacity: 0.4;
  display: flex; align-items: center; justify-content: center;
}
.del-btn:hover { opacity: 1; }
.done-divider { font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 8px; list-style: none; }
.empty-state { padding: 24px 0; text-align: center; color: var(--muted); font-size: 14px; }

/* ============ VISITS ============ */
.visit-list { display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.visit { border-radius: 16px; padding: 14px; background: var(--bg); }
.visit.planned { background: var(--green-soft); }
.visit-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.visit-name { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.25; }
.chip {
  flex-shrink: 0; font-size: 10px; font-weight: 700; border-radius: var(--radius-pill);
  padding: 2px 8px; background: #fff; color: var(--muted); border: 1px solid var(--border);
}
.chip.next { background: var(--green); border: none; color: #fff; }
.chip.last { background: var(--accent); border: none; color: #fff; }
.visit-meta { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.visit-summary { margin: 0; font-size: 12px; color: var(--muted); flex-shrink: 0; }

/* ============ PURCHASE JOURNEY ============ */
.journey-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.journey-head .left { display: flex; align-items: center; gap: 8px; }
.journey-head .actions { display: flex; align-items: center; gap: 8px; }
.btn-soft {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: #fff; color: var(--text);
}
.milestone-badge { font-size: 12px; font-weight: 600; border-radius: var(--radius-pill); padding: 4px 10px; background: var(--green-soft); color: var(--green); }
.milestone-badge.closed { background: var(--rose-soft); color: var(--rose); }

.house-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.house-picker label { font-size: 12px; font-weight: 600; color: var(--muted); }
.house-picker select {
  border-radius: var(--radius-pill); border: 1px solid var(--border); background: #fff;
  padding: 6px 14px; font-size: 12px; font-weight: 600; outline: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.house-chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-pill);
  padding: 4px 10px; font-size: 12px;
}
.house-chip .pr { font-weight: 700; }

/* chip price */
.house-chip.price { background: var(--accent-soft); }
.house-chip.no-price { background: var(--bg); border: 1px dashed var(--dot-idle); color: var(--muted); }
.house-chip.no-price .pr { font-weight: 600; }

.timeline { display: flex; align-items: flex-start; margin-top: 4px; }
.stage { position: relative; display: flex; flex-direction: column; align-items: center; width: 82px; }
.stage-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: none; padding: 0; width: 100%;
}
.stage .circle {
  width: 38px; height: 38px; border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--dot-idle); background: #fff; color: #fff;
}
.stage.status-active .circle { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.stage.status-done .circle { background: var(--green); border-color: var(--green); }
.stage.status-rejected .circle { background: var(--rose); border-color: var(--rose); }
.stage .idle-dot { width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--dot-idle); }
.stage-labels { display: flex; flex-direction: column; align-items: center; }
.stage-name { font-size: 12px; font-weight: 600; line-height: 1.2; text-align: center; }
.stage-status { font-size: 10px; font-weight: 500; color: var(--dot-idle); }
.stage.status-active .stage-status { color: var(--accent); }
.stage.status-done .stage-status { color: var(--green); }
.stage.status-rejected .stage-status { color: var(--rose); }
.connector { flex: 1; height: 2px; border-radius: 2px; margin: 19px 4px 0; min-width: 18px; background: var(--line); }
.connector.done { background: var(--green); }

.stage-pop {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: 208px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 12px; z-index: 40;
}
.pop-title { margin: 0 0 8px; font-size: 12px; font-weight: 700; }
.pop-status {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; border-radius: 12px; border: none; background: transparent;
  font-size: 12px; font-weight: 600; color: var(--muted); text-align: left;
}
.pop-status[aria-pressed="true"] { background: var(--bg); }
.pop-status .dot { width: 8px; height: 8px; border-radius: var(--radius-pill); flex-shrink: 0; }
.pop-status.upcoming .dot { background: var(--dot-idle); }
.pop-status.active .dot { background: var(--accent); }
.pop-status.done .dot { background: var(--green); }
.pop-status.rejected .dot { background: var(--rose); }
.pop-status[aria-pressed="true"].active { color: var(--accent); }
.pop-status[aria-pressed="true"].done { color: var(--green); }
.pop-status[aria-pressed="true"].rejected { color: var(--rose); }
.pop-date-label { display: block; font-size: 10px; font-weight: 700; color: var(--muted); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.pop-date {
  width: 100%; margin-top: 4px; padding: 6px 10px; border-radius: 12px;
  border: 1px solid var(--border); background: #fff; font-size: 12px; outline: none;
}
.journey-tip { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.journey-tip.closed { color: var(--rose); }

/* ============ NOTES ============ */
.note-card { border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.note-card.mu { background: var(--accent-soft); border: 1px solid rgba(226, 114, 91, 0.2); }
.note-card.pi { background: var(--sage-soft); border: 1px solid rgba(122, 148, 113, 0.2); }
.note-head { display: flex; align-items: center; justify-content: space-between; }
.note-id { display: flex; align-items: center; gap: 10px; }
.note-avatar {
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700;
}
.note-card.mu .note-avatar { background: var(--accent); }
.note-card.pi .note-avatar { background: var(--sage); }
.note-head h2 { margin: 0; font-size: 14px; font-weight: 700; }
.saved-ind { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--green); opacity: 0; transition: opacity 0.3s ease; }
.saved-ind.show { opacity: 1; }
.note-card textarea {
  width: 100%; border-radius: 16px; padding: 14px; border: 1px solid rgba(47, 43, 38, 0.12);
  background: rgba(255, 255, 255, 0.75); font-size: 14px; line-height: 1.5; outline: none; resize: vertical;
}
.foot-note { text-align: center; font-size: 12px; color: var(--muted); margin: 0; padding-bottom: 24px; }

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(47, 43, 38, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  width: 100%; max-width: 512px; max-height: 80vh; overflow: hidden;
  background: #fff; border: 1px solid var(--border); border-radius: 22px;
  display: flex; flex-direction: column;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px; border-bottom: 1px solid var(--border); }
.modal-head .file-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.modal-head .file-name p { margin: 0; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-body {
  flex: 1; overflow: auto; margin: 0; padding: 16px; background: var(--bg);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.6;
  white-space: pre-wrap;
}

/* ============ HEADER ACTIONS ============ */
.dash-header .header-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }

/* ============ FORM (add house modal) ============ */
.form-body { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.form-label { font-size: 10px; font-weight: 700; color: var(--muted); margin: 10px 0 2px; letter-spacing: 0.04em; }
.form-input {
  width: 100%; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: #fff; font-size: 13px; outline: none;
}
.form-input:focus { border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 11px; color: var(--muted); margin: 10px 0 0; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 14px; }
.btn-dark.btn-sm { padding: 10px 20px; font-size: 13px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 899px) {
  .dash-grid, .notes-grid { grid-template-columns: 1fr; }
  .timeline { flex-direction: column; align-items: stretch; gap: 0; }
  .stage { width: 100%; flex-direction: row; }
  .stage-btn { flex-direction: row; gap: 12px; padding: 10px 0; align-items: center; }
  .stage-labels { align-items: flex-start; }
  .stage-name, .stage-status { text-align: left; }
  .connector { width: 2px; height: 16px; min-width: 0; margin: 0 0 0 18px; }
  .stage-pop { top: calc(100% + 4px); left: 18px; transform: none; }
  .photo-card { width: 200px; height: 260px; }
  .dash-header { padding-left: 24px; }
  .dash-header .left { flex-wrap: wrap; }
  .house-picker { flex-direction: column; align-items: stretch; gap: 8px; }
  .house-picker label { text-align: left; }
  .house-picker select { width: 100%; }
}
