:root {
  --maroon: #6b1f2a;
  --maroon-dark: #521620;
  --gold: #c99a2e;
  --gold-soft: #fbf3e0;
  --ink: #1d1b1a;
  --muted: #6b6560;
  --line: #d8cec3;
  --bg: #e9e2d9;
  --card: #f5f0e9;
  --input: #fbf8f3;
  --tag: #e6ddd2;
  --green: #1f7a4a;
  --radius: 12px;
}

* { box-sizing: border-box; }

/* Make sure the hidden attribute always wins over display rules below. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
small { color: var(--muted); font-weight: 400; }

.banner {
  background: var(--gold-soft);
  border-bottom: 1px solid #ecd9a8;
  padding: .5rem 1rem;
  text-align: center;
  font-size: .9rem;
}

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.brand img { display: block; }
.brand span { color: var(--maroon); }
.nav { display: flex; gap: .5rem; }

/* Buttons */
.btn {
  display: inline-block; border: 1px solid transparent; border-radius: 999px;
  padding: .55rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; text-align: center;
}
.btn-primary { background: var(--maroon); color: #fff; }
.btn-primary:hover { background: var(--maroon-dark); }
.btn-outline { background: transparent; border-color: var(--maroon); color: var(--maroon); }
.btn-ghost { background: transparent; color: var(--maroon); }
.btn-lg { padding: .8rem 1.5rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-sm { padding: .35rem .8rem; font-size: .85rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.icon-btn { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }

/* Hero */
.hero { max-width: 760px; margin: 0 auto; padding: 3.5rem 1.25rem 2rem; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); letter-spacing: -.02em; }
.hero p { font-size: 1.15rem; color: var(--muted); margin: .75rem auto 1.5rem; max-width: 560px; }
.hero-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* Board */
.board { max-width: 1120px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.filters {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem; margin-bottom: .75rem;
}
.filters input, .filters select { font: inherit; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--input); }
#f-search { flex: 1 1 220px; }
.field-inline { display: flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--muted); }
.field-inline input { width: 9rem; }
.check { display: flex; align-items: center; gap: .35rem; font-size: .9rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; display: flex; flex-direction: column; gap: .55rem;
  transition: box-shadow .2s, border-color .2s;
}
.card.highlight { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.card h3 { font-size: 1.1rem; margin: 0; }
.rent { font-size: 1.5rem; font-weight: 800; white-space: nowrap; }
.rent small { font-size: .85rem; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag { font-size: .78rem; padding: .15rem .55rem; border-radius: 999px; background: var(--tag); color: var(--ink); }
.tag.incentive { background: #e3f4ea; color: var(--green); font-weight: 700; }
.tag.verified { background: var(--gold-soft); color: #8a6512; font-weight: 700; }
.tag.confirmed { background: #e6effa; color: #1d4f91; font-weight: 700; }
.tag.arrangement { background: #f3e8ea; color: var(--maroon); font-weight: 600; }
.link-btn { margin-left: auto; background: none; border: 0; padding: 0; font: inherit; font-size: .8rem; color: var(--muted); text-decoration: underline; cursor: pointer; }
.meta { font-size: .9rem; color: var(--muted); display: grid; gap: .15rem; }
.meta b { color: var(--ink); font-weight: 600; }
.desc { font-size: .92rem; margin: 0; white-space: pre-line; }
.card-actions { display: flex; gap: .5rem; margin-top: auto; padding-top: .4rem; }

.empty { text-align: center; padding: 2.5rem 1rem; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }

/* How it works */
.how {
  max-width: 1120px; margin: 0 auto 3rem; padding: 0 1.25rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem;
}
.how > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.how p { margin: 0; color: var(--muted); }

.footer { border-top: 1px solid var(--line); padding: 1.5rem 1.25rem 2.5rem; text-align: center; font-size: .85rem; color: var(--muted); }
.footer p { max-width: 720px; margin: .3rem auto; }

/* Dialogs & forms */
.dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(560px, 94vw);
  max-height: 92vh; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.dialog { background: var(--card); color: var(--ink); }
.dialog::backdrop { background: rgba(20, 15, 15, .55); }
.form, .form-success { padding: 1.4rem; display: grid; gap: .8rem; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h2 { margin: 0; }
.form label { display: grid; gap: .3rem; font-size: .9rem; font-weight: 600; }
.form input, .form select, .form textarea {
  font: inherit; font-weight: 400; padding: .55rem .65rem;
  border: 1px solid var(--line); border-radius: 8px; width: 100%; background: var(--input);
}
.form input:focus, .form select:focus, .form textarea:focus,
.filters input:focus, .filters select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.row.three { grid-template-columns: 1fr 1fr 1fr; }
.form-error { color: #b42318; margin: 0; font-size: .9rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .6rem 1.1rem; border-radius: 999px;
  font-size: .9rem; z-index: 100;
}

@media (max-width: 560px) {
  .row, .row.three { grid-template-columns: 1fr; }
  .nav .btn-ghost { display: none; }
  .field-inline input { width: 7.5rem; }
}
