/* ============================================================
   Christian Montgomery LLC — design system
   Display: Fraunces (warm serif)   UI/body: Hanken Grotesk
   Palette: eucalyptus green brand, warm paper, pine ink,
            amber used sparingly for status only.
   ============================================================ */

:root {
  --ink: #1f2a26;
  --ink-soft: #3a4742;
  --muted: #6a746e;
  --paper: #f4f3ee;
  --surface: #ffffff;
  --sand: #eae2d4;
  --sand-soft: #f3ede2;
  --brand: #356b52;
  --brand-deep: #234a38;
  --brand-tint: #e4ede7;
  --highlight: #c67a2e;
  --highlight-tint: #f6e8d6;
  --danger: #a23b34;
  --danger-tint: #f4e2e0;
  --line: #e2ded3;
  --line-strong: #cfc9ba;

  --radius: 4px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(31, 42, 38, 0.06), 0 8px 24px rgba(31, 42, 38, 0.06);
  --shadow-lift: 0 2px 6px rgba(31, 42, 38, 0.08), 0 18px 40px rgba(31, 42, 38, 0.12);

  --sans: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;

  --wrap: 1120px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 460;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
  color: var(--ink);
}
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
h3 { font-size: 1.28rem; }

a { color: var(--brand-deep); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

p { margin: 0 0 1rem; }
img { max-width: 100%; display: block; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font: inherit;
  font-weight: 600;
  font-size: 0.96rem;
  padding: 0.66em 1.25em;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
  text-decoration: none;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-quiet { background: transparent; color: var(--brand-deep); padding-left: 0; padding-right: 0; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.45em 0.85em; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.3em 0.6em;
  border-radius: 100px;
  background: var(--brand-tint);
  color: var(--brand-deep);
}
.badge-available { background: var(--brand-tint); color: var(--brand-deep); }
.badge-pending { background: var(--highlight-tint); color: var(--highlight); }
.badge-rented, .badge-declined { background: var(--danger-tint); color: var(--danger); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; }
input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 0.98rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.62em 0.75em;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 1.1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Public header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(244, 243, 238, 0.9);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.brand { display: inline-flex; align-items: baseline; gap: 0.5rem; text-decoration: none; color: var(--ink); }
.brand .mark { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; }
.brand .mark b { color: var(--brand); font-weight: 500; }
.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a { text-decoration: none; color: var(--ink-soft); font-size: 0.95rem; font-weight: 500; }
.nav a:hover { color: var(--brand-deep); }

/* ---------- Hero ---------- */
.hero { padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 5vw, 4rem); }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 3rem; align-items: center; }
.hero h1 { margin-bottom: 0.5rem; }
.hero .lede { font-size: 1.18rem; color: var(--ink-soft); max-width: 46ch; }
.hero-art {
  aspect-ratio: 4 / 3.4;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(31,42,38,0) 40%, rgba(31,42,38,0.28) 100%),
    linear-gradient(135deg, #cfe0d2 0%, #a9c6b1 45%, #dfd2ba 100%);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hero-art img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.hero-art::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,0.4));
}
.hero-art .tag {
  position: absolute; left: 22px; bottom: 20px; color: #fff; z-index: 1;
  font-family: var(--serif); font-size: 1.15rem;
  text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}

/* ---------- Search bar ---------- */
.searchbar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.6rem;
  background: var(--surface);
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-top: 1.8rem;
}
.searchbar input, .searchbar select { border-color: var(--line); }

/* ---------- Section headings ---------- */
.section { padding: 2.5rem 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 1.5rem; gap: 1rem; }
.section-head p { margin: 0; }

/* ---------- Listing grid ---------- */
.listing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.listing-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
  text-decoration: none; color: inherit;
}
.listing-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-3px); border-color: var(--line-strong); }
.listing-photo {
  aspect-ratio: 3 / 2;
  background: linear-gradient(135deg, #d3e0d5, #b6cbbc 60%, #e3d7bf);
  position: relative;
}
.listing-photo .price-chip {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(255,255,255,0.94); color: var(--ink);
  font-weight: 700; font-size: 0.95rem;
  padding: 0.35em 0.7em; border-radius: 100px;
}
.listing-photo.has-photo { background-size: cover; background-position: center; }
.listing-photo .status-chip { position: absolute; right: 12px; top: 12px; }

/* Detail-page gallery */
.detail-hero.has-photo { background-size: cover; background-position: center; }
.thumb-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: -1.2rem 0 2rem; }
.thumb {
  width: 84px; height: 60px; border-radius: 10px; cursor: pointer;
  background-size: cover; background-position: center;
  border: 2px solid transparent; padding: 0; transition: border-color 0.15s ease;
}
.thumb:hover { border-color: var(--line-strong); }
.thumb.active { border-color: var(--brand); }

/* Admin photo manager */
.photo-strip { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.7rem; }
.photo-thumb {
  position: relative; width: 96px; height: 72px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--paper);
}
.photo-thumb.is-cover { border-color: var(--brand); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .cover-tag {
  position: absolute; left: 4px; bottom: 4px; background: var(--brand); color: #fff;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.03em; padding: 0.12em 0.45em; border-radius: 5px;
}
.photo-thumb .photo-x {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%;
  border: none; cursor: pointer; background: rgba(31,42,38,0.82); color: #fff; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.photo-thumb .photo-x:hover { background: var(--danger, #b23b3b); }
#photoUpload { display: flex; align-items: center; gap: 0.75rem; }
.photo-add {
  display: inline-flex; align-items: center; cursor: pointer; font-weight: 600; font-size: 0.9rem;
  color: var(--brand-deep); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 0.5em 0.9em;
}
.photo-add:hover { background: var(--paper); }
.listing-body { padding: 1.1rem 1.15rem 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.listing-body h3 { margin: 0; font-size: 1.15rem; }
.listing-meta { display: flex; gap: 1rem; color: var(--muted); font-size: 0.9rem; margin-top: auto; }
.listing-meta span { display: inline-flex; align-items: center; gap: 0.3em; }
.listing-hood { font-size: 0.9rem; color: var(--brand-deep); font-weight: 600; }

/* ---------- Detail page ---------- */
.detail-hero { aspect-ratio: 16/7; border-radius: var(--radius-lg); background: linear-gradient(135deg, #cfe0d2, #a9c6b1 55%, #dfd2ba); border: 1px solid var(--line); margin-bottom: 2rem; position: relative; }
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 2.5rem; align-items: start; }
.spec-row { display: flex; gap: 2rem; padding: 1rem 0; border-block: 1px solid var(--line); margin: 1.2rem 0; }
.spec-row div span { display: block; }
.spec-row .n { font-family: var(--serif); font-size: 1.5rem; }
.spec-row .l { font-size: 0.82rem; color: var(--muted); }
.amenity-list { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; }
.amenity-list li { background: var(--sand-soft); border: 1px solid var(--line); padding: 0.35em 0.75em; border-radius: 100px; font-size: 0.88rem; }
.apply-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow); position: sticky; top: 90px; }
.apply-card .rent { font-family: var(--serif); font-size: 2rem; }

/* ---------- Panels / generic card ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.5rem; }

/* ---------- Steps (apply flow) ---------- */
.steps { display: flex; gap: 0.5rem; margin-bottom: 2rem; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--muted); }
.step .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); font-size: 0.8rem; font-weight: 700; }
.step.active { color: var(--ink); }
.step.active .num { background: var(--brand); color: #fff; border-color: var(--brand); }
.step.done .num { background: var(--brand-tint); color: var(--brand-deep); border-color: var(--brand-tint); }
.step-arrow { color: var(--line-strong); }

/* ---------- Signature pad ---------- */
.sig-pad { border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--sand-soft); touch-action: none; width: 100%; height: 180px; display: block; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 4rem; padding: 2.5rem 0; color: var(--muted); font-size: 0.9rem; }
.site-footer .cols { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }

/* ---------- Toast / notice ---------- */
.notice { padding: 0.85rem 1rem; border-radius: var(--radius); font-size: 0.92rem; margin-bottom: 1rem; border: 1px solid; }
.notice-ok { background: var(--brand-tint); border-color: #bcd6c6; color: var(--brand-deep); }
.notice-err { background: var(--danger-tint); border-color: #e6c4c1; color: var(--danger); }
.notice-info { background: var(--highlight-tint); border-color: #e8cfae; color: var(--highlight); }

/* ============================================================
   ADMIN
   ============================================================ */
.admin { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #d7ddda; padding: 1.5rem 1rem; display: flex; flex-direction: column; }
.sidebar .brand .mark { color: #fff; }
.sidebar .brand .mark b { color: #8fc3a5; }
.sidebar .brand .sub { color: #8a978f; font-size: 0.72rem; letter-spacing: 0.04em; }
.side-nav { margin-top: 2rem; display: flex; flex-direction: column; gap: 0.15rem; }
.side-nav a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.75rem; border-radius: var(--radius);
  color: #c3ccc7; text-decoration: none; font-size: 0.95rem; font-weight: 500;
}
.side-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.side-nav a.active { background: var(--brand); color: #fff; }
.side-foot { margin-top: auto; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.85rem; }
.side-foot a { color: #9fb0a8; }

.admin-main { padding: 2rem 2.4rem; max-width: 1100px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.8rem; gap: 1rem; flex-wrap: wrap; }
.admin-head h1 { font-size: 1.9rem; margin: 0; }
.admin-head p { margin: 0.2rem 0 0; }

/* Stat tiles */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.2rem; }
.stat .n { font-family: var(--serif); font-size: 2.1rem; line-height: 1; }
.stat .l { color: var(--muted); font-size: 0.88rem; margin-top: 0.4rem; }
.stat .n.brand { color: var(--brand); }

/* Tables */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--line); font-size: 0.94rem; }
th { background: var(--sand-soft); font-weight: 700; font-size: 0.82rem; color: var(--ink-soft); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--sand-soft); }
.row-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

/* File list (forms) */
.file-list { display: flex; flex-direction: column; }
.file-row { display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 1rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--sand-soft); }
.file-icon { width: 40px; height: 44px; border-radius: 4px; display: grid; place-items: center; font-size: 0.62rem; font-weight: 800; color: #fff; letter-spacing: 0.03em; position: relative; }
.file-icon.pdf { background: #b64a3f; }
.file-icon.doc { background: #2f6ba3; }
.file-icon.xls { background: #2f8a5b; }
.file-icon.img { background: #7a6cae; }
.file-icon.txt { background: #6a746e; }
.file-icon.file { background: #97887a; }
.file-name { font-weight: 600; }
.file-sub { color: var(--muted); font-size: 0.84rem; }

/* Dropzone */
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg);
  padding: 2rem; text-align: center; color: var(--muted);
  background: var(--sand-soft); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone.drag { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-deep); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(31,42,38,0.45); display: none; align-items: center; justify-content: center; padding: 1.5rem; z-index: 100; }
.modal-back.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius-lg); padding: 1.75rem; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lift); }
.modal h2 { font-size: 1.4rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(circle at 30% 20%, #e7efe8, var(--paper) 60%); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 2.25rem; width: 100%; max-width: 400px; box-shadow: var(--shadow); }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .listing-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .apply-card { position: static; }
  .searchbar { grid-template-columns: 1fr 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .admin { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.5rem; padding: 1rem; }
  .side-nav { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
  .side-foot { margin: 0 0 0 auto; padding-top: 0; border: none; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .nav { gap: 1rem; }
  .nav .hide-sm { display: none; }
  .listing-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .searchbar { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .file-row { grid-template-columns: auto 1fr auto; }
  .file-row .file-kind, .file-row .file-date { display: none; }
  .admin-main { padding: 1.25rem; }
}
