/* ============================================================
   HausMark UI v1.1 — design system (2026-11-05)
   Modern light theme: deep ink, emerald accent, soft depth.
   No external fonts/CDN — fully offline-safe.
   ============================================================ */
:root {
  --bg: #f4f6f8;
  --bg-soft: #e9edf2;
  --panel: #ffffff;
  --ink: #0f1c2e;
  --ink-2: #3c4a5d;
  --muted: #64748b;
  --line: #e3e8ee;
  --line-strong: #cbd5e1;
  --accent: #0e9f6e;          /* emerald */
  --accent-ink: #057a55;
  --accent-soft: #def7ec;
  --rent-ink: #057a55;  --rent-bg: #def7ec;
  --sale-ink: #b7791f;  --sale-bg: #fcf1d8;
  --danger: #e02424;    --danger-soft: #fde8e8;
  --info-bg: #e1effe;   --info-ink: #1e429f;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 28, 46, .06), 0 1px 3px rgba(15, 28, 46, .08);
  --shadow: 0 4px 10px -2px rgba(15, 28, 46, .10), 0 2px 4px -2px rgba(15, 28, 46, .06);
  --shadow-lg: 0 20px 40px -12px rgba(15, 28, 46, .18);
  --font: "Inter", "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}
main.container { flex: 1 0 auto; width: 100%; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 24px;
  height: 64px; display: flex; align-items: center; gap: 28px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.18rem; color: var(--ink); letter-spacing: -.02em;
}
.brand .mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #0e9f6e 0%, #0ea5e9 100%);
  color: #fff; font-size: 18px; box-shadow: var(--shadow-sm);
}
.topnav { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.topnav a NavLink, .topnav > a, .topnav .navitem {
  color: var(--ink-2); font-weight: 600; font-size: .93rem;
  padding: 8px 14px; border-radius: 999px; transition: .15s;
}
.topnav > a:hover, .topnav .navitem:hover { background: var(--bg-soft); color: var(--ink); }
.topnav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.userchip { display: flex; align-items: center; gap: 10px; }
.userchip .hello { color: var(--muted); font-size: .9rem; font-weight: 600; }
.badge-unread {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px;
  padding: 0 6px; margin-left: 6px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: .72rem; font-weight: 800;
  vertical-align: middle;
}
.linkform { display: inline; }
button.linklike {
  background: none; border: 0; padding: 8px 14px; font: inherit; font-weight: 600;
  color: var(--ink-2); cursor: pointer; border-radius: 999px; transition: .15s;
}
button.linklike:hover { background: var(--bg-soft); color: var(--ink); }
button.linklike.danger { color: var(--danger); }
button.linklike.danger:hover { background: var(--danger-soft); }

/* ---------- layout ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 28px 24px 64px; }
.footer {
  border-top: 1px solid var(--line); padding: 28px 24px 40px; text-align: center;
  color: var(--muted); font-size: .85rem;
}
.footer b { color: var(--ink-2); }

/* ---------- flash toasts ---------- */
.flash-stack { max-width: 1120px; margin: 14px auto 0; padding: 0 24px; }
.flash {
  display: flex; align-items: center; gap: 10px;
  background: var(--accent-soft); color: var(--accent-ink);
  border: 1px solid #bcf0da; border-radius: var(--radius-sm);
  padding: 11px 16px; margin: 8px 0; font-weight: 600; box-shadow: var(--shadow-sm);
}
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: #f8b4b4; }

/* ---------- hero + filters (browse) ---------- */
.hero {
  background:
    radial-gradient(800px 300px at 85% -60%, rgba(14, 165, 233, .14), transparent 60%),
    radial-gradient(700px 280px at 15% -40%, rgba(14, 159, 110, .16), transparent 60%),
    var(--panel);
  border: 1px solid var(--line); border-radius: 24px;
  padding: 44px 40px 36px; box-shadow: var(--shadow);
  margin-bottom: 26px;
}
.hero h1 { font-size: 2rem; margin: 0 0 6px; }
.hero p { color: var(--muted); margin: 0; max-width: 60ch; }
.filterbar {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px;
}
.filterbar select {
  flex: 1 1 160px; padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--panel); font: inherit; color: var(--ink);
}
.filterbar button {
  padding: 10px 22px; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-weight: 700;
  box-shadow: var(--shadow-sm); transition: .15s;
}
.filterbar button:hover { background: var(--accent-ink); }
.count-line {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 4px 2px 16px; color: var(--muted); font-size: .95rem;
}
.count-line b { color: var(--ink); font-size: 1.05rem; }

/* ---------- listing cards ---------- */
.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.card {
  position: relative; display: flex; flex-direction: column; gap: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0; color: var(--ink); box-shadow: var(--shadow-sm); transition: .18s;
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: auto 0 0 0; height: 4px;
  background: linear-gradient(90deg, var(--accent), #0ea5e9); opacity: 0; transition: .18s;
  z-index: 2;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--line-strong); }
.card:hover::before { opacity: 1; }
.card-content { display: flex; flex-direction: column; gap: 6px; padding: 16px 20px 20px; }
.card h3 { margin: 4px 0 2px; font-size: 1.08rem; }
.card .price { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.card .meta { color: var(--muted); font-size: .88rem; }
.card .type-note { margin-top: auto; padding-top: 10px; }

/* deterministic gradient media per property type (no image uploads in v1) */
.card-media {
  position: relative;
  height: 118px; display: grid; place-items: center; font-size: 52px;
  border-bottom: 1px solid var(--line);
}
.card-media.big { height: 170px; border-radius: 24px 24px 0 0; border-bottom: 0; }
.card-media.tall { height: min(420px, 48vw); border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; }
.m-apartment     { background: linear-gradient(135deg, #dbeafe, #93c5fd); }
.m-house         { background: linear-gradient(135deg, #d1fae5, #6ee7b7); }
.m-vacation_home { background: linear-gradient(135deg, #fef3c7, #f9a8d4); }
.m-other         { background: linear-gradient(135deg, #e2e8f0, #94a3b8); }
.card-media span { filter: drop-shadow(0 6px 10px rgba(15, 28, 46, .18)); }
img.coverimg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: inherit;
}
.card-media .media-fallback { position: absolute; inset: 0; display: grid; place-items: center; }

/* photo gallery + owner manager */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.gallery a { position: relative; display: block; }
.gallery img {
  width: 100%; height: 96px; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--line); transition: .15s;
}
.gallery a:hover img { border-color: var(--accent); box-shadow: var(--shadow); }
.cover-tag {
  position: absolute; top: 8px; left: 8px;
  font-size: .68rem; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: #fff; text-transform: uppercase; letter-spacing: .04em;
}
.mgd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.mgd { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.mgd img { width: 100%; height: 92px; object-fit: cover; border-radius: 8px; display: block; }
.mgd-actions { display: flex; gap: 6px; align-items: center; justify-content: space-between; margin-top: 8px; flex-wrap: wrap; }
.img-manager h2 { margin: 4px 0 2px; }
.form input[type="file"] { padding: 9px; background: var(--bg); }

/* map card (v1.4) */
.mapcard { isolation: isolate; }  /* contains leaflet panes below the sticky topbar */
#listingmap { height: 300px; border-radius: 12px; border: 1px solid var(--line);
  z-index: 1; background: var(--bg-soft); }
.leaflet-popup-content { font: 13px/1.4 var(--font); }

/* rating stars */
.rateform { display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.starbtn {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 8px; margin-left: 4px; cursor: pointer; font: inherit; font-size: .9rem;
  color: #b7791f; background: var(--panel); transition: .12s; letter-spacing: .05em;
}
.starbtn:hover { border-color: #f59e0b; background: #fef3c7; transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .74rem; font-weight: 700; padding: 4px 11px; border-radius: 999px;
  letter-spacing: .02em;
}
.pill.rent { background: var(--rent-bg); color: var(--rent-ink); }
.pill.sale { background: var(--sale-bg); color: var(--sale-ink); }
.pill.type { background: var(--bg-soft); color: var(--ink-2); }
.pill.active { background: var(--accent-soft); color: var(--accent-ink); }
.pill.rating { background: #fff7e0; color: #b7791f; }
.pill.withdrawn { background: var(--bg-soft); color: var(--muted); }

.pager { display: flex; gap: 8px; margin-top: 26px; flex-wrap: wrap; }
.pager a {
  min-width: 38px; text-align: center; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); font-weight: 600; color: var(--ink-2); box-shadow: var(--shadow-sm);
}
.pager a:hover { border-color: var(--accent); color: var(--accent-ink); }
.pager a.current { background: var(--accent); border-color: var(--accent); color: #fff; }

.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
  background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.empty .big { font-size: 2rem; display: block; margin-bottom: 8px; }

/* ---------- listing detail ---------- */
.detail-hero {
  background: var(--panel); border: 1px solid var(--line); border-radius: 24px;
  padding: 36px 40px; box-shadow: var(--shadow); margin-bottom: 22px; overflow: hidden;
}
.detail-hero .price.big {
  font-size: 2rem; font-weight: 800; letter-spacing: -.02em; color: var(--accent-ink);
  margin: 10px 0 2px;
}
.facts time, .ts { font-weight: 600; }
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: start; }
.facts-card, .contact-card, .simple-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 26px; box-shadow: var(--shadow-sm);
}
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0; }
.facts dt { color: var(--muted); font-size: .9rem; font-weight: 600; }
.facts dd { margin: 0; font-weight: 600; }
.description h2, .contact-card h2 { font-size: 1.05rem; margin: 0 0 10px; }
.contact-note { color: var(--muted); }

/* ---------- forms ---------- */
.form-card, .auth-card {
  max-width: 640px; margin: 0 auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 24px; padding: 36px 40px;
  box-shadow: var(--shadow);
}
.auth-card { max-width: 440px; }
.form-card h1, .auth-card h1 { margin-top: 0; font-size: 1.5rem; }
.form label { display: block; margin: 16px 0 0; color: var(--ink-2); font-size: .88rem; font-weight: 700; }
.form input, .form textarea, .form select, .filterbar select {
  width: 100%; margin-top: 6px; padding: 11px 13px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--panel); font: inherit; color: var(--ink); transition: .15s;
}
.form input:focus, .form textarea:focus, .form select:focus, .filterbar select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(14, 159, 110, .12);
}
.form textarea { resize: vertical; min-height: 90px; }
.form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: var(--radius-sm); cursor: pointer;
  padding: 12px 22px; font: inherit; font-weight: 700; transition: .15s;
  background: var(--accent); color: #fff; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--accent-ink); box-shadow: var(--shadow); }
.btn-ghost {
  background: var(--panel); color: var(--ink-2); border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--bg-soft); box-shadow: var(--shadow-sm); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c81e1e; }
.btn-sm { padding: 7px 14px; font-size: .85rem; border-radius: 8px; }

/* ---------- dashboard table ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 32px 36px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.panel-head h1 { margin: 0; font-size: 1.5rem; }
.table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.table th {
  text-align: left; padding: 10px 12px; color: var(--muted); font-size: .78rem;
  text-transform: uppercase; letter-spacing: .06em; border-bottom: 2px solid var(--line);
}
.table td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--bg); }
.table td.actions { display: flex; gap: 10px; align-items: center; }
.table td.actions form { display: inline; }

/* ---------- inbox ---------- */
.tabs { display: inline-flex; gap: 4px; background: var(--bg-soft); padding: 4px; border-radius: 12px; margin: 14px 0 18px; }
.tabs a { padding: 8px 18px; border-radius: 9px; font-weight: 700; color: var(--muted); font-size: .92rem; }
.tabs a.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }
.msg {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 22px; margin: 12px 0; box-shadow: var(--shadow-sm); transition: .15s;
}
.msg:hover { box-shadow: var(--shadow); }
.msg.unread { border-left: 4px solid var(--accent); }
.msg-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.msg-head .when { color: var(--muted); font-size: .82rem; margin-left: auto; }
.msg .subject { margin-top: 6px; font-size: 1.02rem; }
.msg .body { color: var(--ink-2); margin: 6px 0 12px; white-space: pre-wrap; }
.msg .about { font-size: .85rem; color: var(--muted); }
.msg .actions { display: flex; gap: 12px; align-items: center; }

.muted { color: var(--muted); }
.error-page { text-align: center; padding: 72px 0; }
.error-page h1 { font-size: 5rem; margin: 0; color: var(--line-strong); font-weight: 800; }
.error-page p { color: var(--muted); font-size: 1.05rem; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; }
  .hero { padding: 28px 22px; }
  .form-card, .auth-card, .panel, .detail-hero { padding: 24px 20px; }
  .topbar-inner { padding: 0 16px; gap: 14px; }
  .userchip .hello { display: none; }
  .form .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .table td.actions { flex-direction: column; align-items: flex-start; }
  .facts { grid-template-columns: 1fr; gap: 2px 0; }
  .facts dd { margin-bottom: 10px; }
}
