:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #1f2328;
  --muted: #6b7076;
  --line: #e6e1d9;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --today: #fff6d6;
  --co: #b88a00;
  --co-bg: #fff4c7;
  --us: #2846a8;
  --us-bg: #e3e9ff;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Buttons & form controls ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 500;
}
.btn:hover { border-color: #cfc8bc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field { margin-bottom: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.error { color: var(--danger); font-size: 14px; min-height: 0; }
.error:not(:empty) { margin: 4px 0 12px; }
.notice { background: #e8f4ef; color: #14513f; padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }

/* ---------- Auth ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 8px 30px rgba(40, 30, 10, .08);
}
.auth-card h1 { margin: 0 0 4px; font-size: 24px; }
.auth-card .sub { margin: 0 0 20px; color: var(--muted); }
.auth-card .btn.primary { width: 100%; padding: 11px; margin-top: 4px; }
.auth-foot { margin-top: 16px; font-size: 14px; color: var(--muted); text-align: center; display: grid; gap: 6px; }
.prop-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.prop-strip figure { margin: 0; }
.prop-strip .photo { aspect-ratio: 1; border-radius: 8px; }
.prop-strip .photo span { font-size: 10px; }
.prop-strip figcaption { font-size: 11px; font-weight: 600; text-align: center; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Property photos ---------- */
.photo {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000));
  display: grid; place-items: center;
}
.photo span { color: #fff; font-weight: 700; font-size: 14px; text-align: center; padding: 4px; opacity: .9; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.demo-banner {
  background: #fff1d6; color: #7a4b00; text-align: center; font-size: 13px; padding: 6px 12px;
}

/* ---------- Main layout ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; }
.me { font-size: 14px; color: var(--muted); display: flex; gap: 12px; align-items: center; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 16px; }

.tabs { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding: 2px 2px 6px; margin-bottom: 12px; }
.pcard {
  border: 2px solid transparent; background: var(--surface); border-radius: 12px; padding: 0;
  text-align: left; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: flex; flex-direction: column;
}
.pcard .photo { height: 92px; }
.pcard .photo-grid { height: 92px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.pcard .photo.mini { height: auto; }
.pcard .photo.mini span { display: none; }
.pcard .pinfo { padding: 8px 10px 10px; }
.pcard .pname { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.pcard .pname .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.pcard .punit { font-size: 12px; font-weight: 600; color: var(--ink); margin-top: 1px; }
.pcard .pmeta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pcard:hover { box-shadow: 0 3px 10px rgba(0,0,0,.1); }
.pcard[aria-pressed="true"] { border-color: var(--c, var(--ink)); }
.tab {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 99px; padding: 7px 14px; white-space: nowrap; font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px;
}
.tab .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.tab[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.controls .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 7px 14px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.hol-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; }
.hol-toggle input { width: auto; margin: 0; }

.badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .03em; padding: 1px 4px; border-radius: 4px; }
.badge.co { background: var(--co); color: #fff; }
.badge.us { background: var(--us); color: #fff; }

/* ---------- Property details ---------- */
.info-panel {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px;
}
.info-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 18px; }
.info-grid.compact { grid-template-columns: 1fr 1fr; background: #faf8f4; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.ilabel { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ival { font-size: 14px; font-weight: 500; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.ival.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ival .copy { padding: 1px 8px; font-size: 11px; margin-left: 4px; font-family: Inter, system-ui, sans-serif; vertical-align: 1px; }
.tel { color: var(--accent); font-weight: 600; white-space: nowrap; }
.info-item.wide { grid-column: 1 / -1; }
.missing { color: var(--muted); font-weight: 400; font-style: italic; }

/* ---------- Calendar ---------- */
.cal { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.cal-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.cal-head h2 { margin: 0 8px 0 4px; font-size: 18px; flex: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dow { font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); text-transform: uppercase; }
.day {
  min-height: 108px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 4px 0 6px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.day:nth-child(7n) { border-right: 0; }
.day:hover { background: #faf8f4; }
.day.other { background: #fbfaf7; color: #b0aaa0; }
.day.today { background: var(--today); }
.day.weekend .num { color: var(--muted); }
.day .num { font-size: 13px; font-weight: 600; padding: 0 8px; }
.day.today .num span { background: var(--ink); color: #fff; border-radius: 99px; padding: 1px 6px; }
.day.has-hol .num { color: var(--ink); }
.day .hols { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.hol {
  font-size: 11px; line-height: 1.25; padding: 1px 6px; margin: 0 4px;
  border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hol.co { background: var(--co-bg); color: #6b5000; }
.hol.us { background: var(--us-bg); color: #1d3480; }
.chip {
  display: block; width: 100%; text-align: left; border: 0;
  background: var(--c); color: #fff;
  font-size: 12px; font-weight: 600; line-height: 1.3;
  padding: 2px 6px; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip.start { border-top-left-radius: 6px; border-bottom-left-radius: 6px; margin-left: 4px; width: calc(100% - 4px); }
.chip.end { border-top-right-radius: 6px; border-bottom-right-radius: 6px; width: calc(100% - 4px); }
.chip.start.end { width: calc(100% - 8px); }
.chip:hover { filter: brightness(1.1); }

.month-hols { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.month-hols h3 { margin: 0 0 8px; font-size: 14px; }
.month-hols ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; font-size: 14px; }
.month-hols li { display: flex; gap: 8px; align-items: center; }
.month-hols .d { color: var(--muted); min-width: 82px; }

/* ---------- List ---------- */
.list-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.list-head h2 { margin: 0; font-size: 18px; flex: 1; }
.month-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }
.res {
  display: grid; grid-template-columns: 6px 72px 1fr auto; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px 12px 0; margin-bottom: 8px; overflow: hidden;
}
.res .bar { background: var(--c); border-radius: 0 4px 4px 0; }
.res .photo.thumb { width: 72px; height: 72px; border-radius: 8px; }
.res .photo.thumb span { font-size: 10px; }
.res .title { font-weight: 600; }
.res .prop { color: var(--c); font-weight: 600; font-size: 13px; }
.res .dates { font-size: 14px; }
.res .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.res .notes { font-size: 13px; margin-top: 4px; white-space: pre-wrap; }
.res .hols { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.res .hols .hol { margin: 0; }
.res .actions { display: flex; gap: 6px; align-items: flex-start; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- Modal ---------- */
dialog {
  border: 0; border-radius: 14px; padding: 0;
  width: min(460px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(20, 20, 20, .4); }
.modal-body { padding: 22px 22px 18px; }
.banner { margin: -22px -22px 16px; }
.banner .photo.wide { height: 150px; }
.banner .photo.wide span { font-size: 20px; }
.modal-body h2 { margin: 0 0 16px; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.modal-body h2 .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.modal-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.modal-actions .spacer { flex: 1; }
.hint { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.hint .hols { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.hint .hol { margin: 0; }
.detail { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 14px; margin-bottom: 12px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; white-space: pre-wrap; }

/* ---------- Phones ---------- */
@media (max-width: 640px) {
  .wrap { padding: 12px; }
  .day { min-height: 74px; }
  .day .num { padding: 0 4px; font-size: 12px; }
  .day .hol { font-size: 0; padding: 0; height: 4px; margin: 0 3px; }
  .day .hol .badge { display: none; }
  .hol.co { background: var(--co); }
  .hol.us { background: var(--us); }
  .chip { font-size: 10px; padding: 1px 3px; }
  .dow { padding: 6px 4px; font-size: 11px; }
  .res { grid-template-columns: 6px 56px 1fr; }
  .res .photo.thumb { width: 56px; height: 56px; }
  .res .actions { grid-column: 3; }
  .tabs { grid-template-columns: repeat(5, 140px); }
  .pcard .photo, .pcard .photo-grid { height: 72px; }
  .me .who { display: none; }
  .info-panel { flex-direction: column; }
  .info-grid { grid-template-columns: 1fr 1fr; }
}
