:root {
  /* palette sampled directly from your watercolor icon set */
  --cream: #E8F1F3;
  --paper: #FFFDF9;
  --ink: #332B24;
  --ink-soft: #7A7266;
  --line: rgba(51, 43, 36, 0.14);
  --blue: #2B6E9C;
  --blue-deep: #173A5E;
  --pink: #DB7EA2;
  --pink-deep: #A84E70;
  --gold: #D08A3A;
  --gold-deep: #9D5511;
  --sage: #2F7A55;
  --sage-deep: #1F5A3D;
  --lavender: #8B7BB8;
  --radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Inter', -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  margin: 0;
}

button { font-family: inherit; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  background: var(--sage-deep);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 48px; height: 48px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand h1 { font-size: 19px; letter-spacing: 0.01em; color: #fff; }
.tagline { margin: 2px 0 0; font-size: 12px; color: rgba(255,255,255,0.75); }
.icon-btn {
  background: none; border: none; font-size: 18px; color: #fff;
  padding: 6px; cursor: pointer;
}

/* ---------- Tabs ---------- */
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px 14px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.tab {
  border: 1.5px solid var(--line);
  background: var(--cream);
  border-radius: 16px;
  padding: 12px 6px 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s, background 0.15s;
}
.tab-icon {
  width: 68px; height: 68px;
  opacity: 0.7;
  filter: saturate(0.8);
  transition: opacity 0.15s, filter 0.15s;
}
.tab-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tab.active .tab-icon { opacity: 1; filter: none; }
.tab.active {
  color: var(--ink);
  border-color: var(--gold);
  background: #FBF0DF;
}

main { padding: 16px 16px 40px; max-width: 720px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }
.panel-intro { color: var(--ink-soft); font-size: 13px; margin: 0 0 14px; }

/* ---------- Summary strip ---------- */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.summary-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
}
.summary-card.gold { border-color: var(--gold); background: #FBF0DF; }
.summary-card.blue { border-color: var(--blue); background: #E8EEF6; }
.summary-card.wide { grid-column: 1 / -1; }
.summary-num {
  display: block;
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 600;
}
.summary-label {
  display: block;
  font-size: 10.5px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* ---------- List toolbar ---------- */
.list-toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
#searchBox {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--paper);
}

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn.primary { background: var(--gold); color: #fff; }
.btn.primary:active { background: var(--gold-deep); }
.btn.ghost { background: none; border: 1px solid var(--line); color: var(--ink); margin-top: 10px; }
.btn.danger-ghost { background: none; border: 1px solid var(--pink); color: #B5527A; }

/* ---------- Property list ---------- */
.property-list { list-style: none; margin: 0; padding: 0; }
.property-card {
  background: #FFFFFF;
  border: none;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(51, 43, 36, 0.08);
}

.card-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.card-row-icon {
  width: 46px; height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--cream);
  padding: 6px;
  box-sizing: border-box;
}
.card-row-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card-row-main { flex: 1; min-width: 0; }
.card-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.property-address {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--blue-deep);
}
.card-row-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

.pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 11px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
}
.pill-occupied { background: #E4EFE9; color: var(--sage-deep); border: 1px solid var(--sage); }
.pill-upcoming { background: #E8EEF6; color: var(--blue-deep); border: 1px solid var(--blue); }
.pill-available { background: #FBE9F0; color: var(--pink-deep); border: 1px solid var(--pink); }
.pill-paused { background: #EEE9F6; color: var(--lavender-deep, #5E4E8C); border: 1px solid var(--lavender); }

.property-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.property-meta strong { color: var(--ink); font-weight: 600; }
.commission-tag { color: var(--gold-deep); font-weight: 700; }
.property-meta-fixed {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
  padding-top: 8px;
  margin-left: 58px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--ink-soft);
}
.stay-summary-list { margin-top: 10px; margin-left: 58px; }
.stay-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.stay-summary-row:last-child { border-bottom: none; }
.stay-summary-tenant { font-weight: 600; color: var(--ink); }
.stay-summary-dates { color: var(--ink-soft); }
.stay-summary-amt { color: var(--ink-soft); font-size: 12px; }
.stay-summary-amt.commission-tag { color: var(--gold-deep); font-weight: 700; }

.empty-note { color: var(--ink-soft); text-align: center; padding: 30px 10px; font-size: 13.5px; }
.empty-note img { width: 90px; height: 90px; object-fit: contain; display: block; margin: 0 auto 10px; opacity: 0.85; }

/* ---------- Reports ---------- */
.report-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.report-card h2 { font-size: 16px; margin-bottom: 6px; }
.report-card p { font-size: 13px; color: var(--ink-soft); margin: 0 0 12px; }
.report-controls { display: flex; gap: 8px; margin-bottom: 4px; }
.report-controls input {
  flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13.5px;
}
.hint { font-size: 12px; color: var(--sage); margin-top: 8px; }

.ytd-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.ytd-table th, .ytd-table td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.ytd-total { text-align: right; font-weight: 700; margin-top: 8px; font-family: 'Fraunces', serif; }

/* ---------- Expanding card body / inline form ---------- */
.card-body {
  display: none;
  border-top: 1px solid var(--line);
  padding: 14px 2px 2px;
  margin-top: 10px;
}
.property-card.open .card-body { display: block; }
.property-card.open { cursor: default; }
.chevron { color: var(--ink-soft); font-size: 12px; transition: transform 0.15s; flex-shrink: 0; margin-top: 4px; }
.property-card.open .chevron { transform: rotate(180deg); }

.card-body form label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 12px;
  font-weight: 500;
}
.card-body input, .card-body select, .card-body textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}
.req { color: var(--pink); }
.checkbox-label { display: flex !important; align-items: center; gap: 8px; }
.checkbox-label input[type="checkbox"] { width: auto !important; margin: 0 !important; flex-shrink: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--blue); font-weight: 700; margin: 16px 0 8px;
}

/* ---------- Stays (tenant history / future bookings) ---------- */
.stays-list { margin-bottom: 6px; }
.stay-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 10px 4px;
  margin-bottom: 10px;
  background: var(--cream);
  position: relative;
}
.stay-row .grid-2 { margin-bottom: 0; }
.stay-row label { margin-bottom: 8px; }
.stay-remove {
  position: absolute; top: 8px; right: 8px;
  background: none; border: none; color: var(--pink-deep, #B5527A);
  font-size: 11px; cursor: pointer; font-weight: 600;
}
.stay-badge {
  display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 10px;
  background: #E4EFE9; color: var(--sage-deep); margin-bottom: 6px;
}
.stay-badge.upcoming { background: #E8EEF6; color: var(--blue-deep); }
.stay-badge.past { background: #F0EDE7; color: var(--ink-soft); }
.add-stay-btn { width: 100%; margin-bottom: 14px; }

.ledger-section { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ledger-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); margin-bottom: 6px; }
.ledger-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px dashed var(--line);
}
.ledger-row:last-child { border-bottom: none; }
.ledger-month { width: 64px; flex-shrink: 0; color: var(--ink-soft); font-weight: 600; }
.ledger-check { display: flex !important; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink); margin-bottom: 0 !important; }
.ledger-check input[type="checkbox"] { width: auto !important; margin: 0 !important; }

.expense-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 10px 4px;
  margin-bottom: 10px;
  background: var(--cream);
  position: relative;
}
.expense-row label { margin-bottom: 8px; }

.files-section { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.files-section h3, .files-section .section-label { margin-top: 0; }
.file-list { list-style: none; padding: 0; margin: 0 0 10px; }
.file-list li {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; padding: 6px 0; border-bottom: 1px dashed var(--line);
}
.file-list a { color: var(--blue-deep); text-decoration: none; }
.upload-row { display: flex; gap: 8px; flex-wrap: wrap; }
.upload-row select { width: auto; flex-shrink: 0; }
.upload-row input[type="file"] { flex: 1; min-width: 120px; }
.paste-btn { flex-shrink: 0; white-space: nowrap; }
.stay-files-section { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }

.card-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; gap: 10px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 20px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
