:root {
  --bg: #07111f;
  --bg-2: #0a1a2f;
  --panel: #0e1d30;
  --panel-2: #122338;
  --line: #1a3050;
  --gold: #c9a84c;
  --gold-2: #e8c46a;
  --text: #ffffff;
  --muted: #a8bbcf;
  --muted-2: #6b7fa0;
  --green: #27ae60;
  --red: #e74c3c;
  --blue: #3b82f6;
  --amber: #f59e0b;
  --shadow: 0 20px 50px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
a { color: inherit; }
.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(7, 17, 31, .9);
  border-bottom: 1px solid rgba(201, 168, 76, .18);
  backdrop-filter: blur(18px);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  height: 68px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  border: 0;
  background: transparent !important;
  color: inherit;
  padding: 0;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  text-decoration: none;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--gold);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: -.04em;
}
.brand-name { font-weight: 850; letter-spacing: -.02em; }
.brand-sub { color: var(--gold-2); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .16em; }
.nav {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 4px;
}
.nav button {
  padding: 9px 13px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.nav button:hover, .nav button.active { color: var(--text); background: rgba(201, 168, 76, .1); }
.actions { display: flex; align-items: center; gap: 10px; }
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(201, 168, 76, .28);
  border-radius: 999px;
  background: rgba(9, 23, 38, .72);
}
.lang-toggle button {
  min-width: 34px;
  min-height: 28px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}
.lang-toggle button.active {
  background: var(--gold);
  color: var(--bg);
}

.btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: transform .18s, background .18s, border-color .18s;
}
.btn:hover { transform: translateY(-1px); }
.btn-gold { background: var(--gold); color: var(--bg); }
.btn-gold:hover { background: var(--gold-2); }
.btn-outline { background: transparent; color: var(--gold-2); border: 1px solid rgba(201, 168, 76, .42); }
.btn-ghost { background: #1a3050; color: var(--muted); }
.btn-danger { background: var(--red); color: white; }
.btn-small { min-height: 30px; padding: 6px 10px; font-size: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.hero {
  min-height: calc(100vh - 68px);
  padding: 80px 24px 54px;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #07111f 0%, #0e1d30 58%, #07111f 100%);
}
.hero-inner {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 54px;
  align-items: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px 14px;
  border: 1px solid rgba(201, 168, 76, .3);
  border-radius: 999px;
  color: var(--gold-2);
  background: rgba(201, 168, 76, .08);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0 0 22px;
  max-width: 820px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1.02;
  letter-spacing: -.03em;
}
.gold { color: var(--gold); font-style: italic; }
.hero p {
  max-width: 610px;
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 17px;
}
.hero-card {
  min-height: 420px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(201, 168, 76, .22);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.hero-card-image {
  height: 100%;
  min-height: 420px;
  background-size: cover;
  background-position: center;
}

.section {
  padding: 82px 24px;
}
.section.alt { background: var(--bg-2); }
.container { max-width: 1240px; margin: 0 auto; }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
}
.section-title {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.1;
}
.section-copy { max-width: 650px; margin: 10px 0 0; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}
.public-card {
  background: linear-gradient(135deg, var(--panel), var(--panel-2));
  border-color: rgba(201, 168, 76, .14);
}
.card h3, .card h4 { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; color: var(--muted-2); }
.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.feature-list span {
  border: 1px solid rgba(201, 168, 76, .28);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--gold-2);
  background: rgba(201, 168, 76, .08);
  font-size: 12px;
  font-weight: 800;
}

.listing-card {
  padding: 0;
  overflow: hidden;
}
.listing-image {
  aspect-ratio: 16 / 10;
  background: #1a3050;
  background-position: center;
  background-size: cover;
}
.listing-body { padding: 18px; }
.listing-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.price { margin: 8px 0 0; color: var(--gold-2); font-family: "Playfair Display", Georgia, serif; font-size: 25px; font-weight: 800; }

.login-page {
  min-height: calc(100vh - 68px);
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, var(--bg), var(--bg-2));
}
.login-card { width: min(430px, 100%); }
code { color: var(--gold-2); }

.portal-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 68px);
}
.sidebar {
  border-right: 1px solid var(--line);
  background: #091726;
  padding: 22px 16px;
}
.side-title { color: var(--gold-2); font-weight: 850; margin-bottom: 14px; }
.tab-list { display: grid; gap: 5px; }
.tab-list button {
  width: 100%;
  text-align: left;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.tab-list button.active, .tab-list button:hover { background: rgba(201, 168, 76, .1); color: white; }
.portal-main { padding: 28px; min-width: 0; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0 0 4px; font-family: "Playfair Display", Georgia, serif; font-size: 32px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { border-left: 3px solid var(--gold); }
.kpi-label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.kpi-value { margin-top: 4px; font-size: 27px; font-weight: 900; }

.table-wrap { overflow-x: auto; padding: 0; max-width: 100%; }
.card, .table-wrap, .topbar-inner, .portal-shell, .sidebar { min-width: 0; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th {
  text-align: left;
  padding: 11px 14px;
  color: var(--gold-2);
  background: #091726;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
td { padding: 13px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; vertical-align: top; }
td strong { color: white; }
.row-actions { display: flex; gap: 6px; justify-content: end; white-space: nowrap; }
.finance-grid .page-head { align-items: center; margin-bottom: 12px; }
.statement-builder { display: grid; gap: 14px; margin-bottom: 18px; }
.statement-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}
.statement-total {
  min-width: 170px;
  border-left: 3px solid var(--gold);
  padding-left: 14px;
  text-align: right;
}
.statement-total span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.statement-total strong {
  color: var(--gold-2);
  font-size: 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.badge-ok, .badge-green { color: var(--green); background: rgba(39, 174, 96, .12); border: 1px solid rgba(39, 174, 96, .3); }
.badge-attention, .badge-amber { color: var(--amber); background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .3); }
.badge-urgent, .badge-red { color: var(--red); background: rgba(231, 76, 60, .12); border: 1px solid rgba(231, 76, 60, .3); }
.badge-blue { color: var(--blue); background: rgba(59, 130, 246, .12); border: 1px solid rgba(59, 130, 246, .3); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
label { color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #091726;
  color: white;
  padding: 11px 12px;
}
textarea { min-height: 106px; resize: vertical; }
.textarea-tall { min-height: 220px; }
input:focus, textarea:focus, select:focus { border-color: rgba(201, 168, 76, .7); }
.checkbox-row { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.checkbox-row input { width: auto; }

.finding {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #091726;
  padding: 14px;
  margin-bottom: 12px;
}
.finding-top {
  display: grid;
  grid-template-columns: 1fr 150px auto;
  gap: 10px;
  align-items: end;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, .74);
  backdrop-filter: blur(7px);
}
.modal {
  width: min(780px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.modal-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 16px; }
.modal h2 { margin: 0; font-family: "Playfair Display", Georgia, serif; }
.notice {
  margin-bottom: 14px;
  border: 1px solid rgba(201, 168, 76, .32);
  border-radius: 8px;
  padding: 12px;
  color: var(--gold-2);
  background: rgba(201, 168, 76, .08);
}
.empty { padding: 28px; text-align: center; color: var(--muted-2); }

@media (max-width: 920px) {
  .topbar-inner { height: auto; min-height: 68px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
  .brand { min-width: 0; }
  .actions { margin-left: auto; }
  .nav { order: 3; flex: 1 1 100%; min-width: 0; justify-content: flex-start; overflow-x: auto; padding-bottom: 4px; }
  .nav::-webkit-scrollbar, .tab-list::-webkit-scrollbar { height: 4px; }
  .hero-inner, .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .hero-card { display: none; }
  .portal-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .tab-list { display: flex; overflow-x: auto; }
  .tab-list button { white-space: nowrap; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finding-top { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .hero { min-height: auto; padding-top: 54px; }
  .hero h1 { font-size: 40px; }
  .kpis { grid-template-columns: 1fr; }
  .page-head { align-items: stretch; flex-direction: column; }
  .actions { flex-wrap: wrap; justify-content: end; }
}

@media print {
  body { background: white; color: #111827; }
  .topbar, .sidebar, .modal-head button, .statement .btn, .modal-actions { display: none !important; }
  .modal-backdrop {
    position: static;
    display: block;
    padding: 0;
    background: white;
    backdrop-filter: none;
  }
  .modal {
    width: 100%;
    max-height: none;
    overflow: visible;
    border: 0;
    box-shadow: none;
    color: #111827;
    background: white;
  }
  .card, .finding, input, textarea, select {
    background: white;
    color: #111827;
    border-color: #d1d5db;
  }
  th { background: #f3f4f6; color: #111827; }
  td { color: #374151; border-color: #e5e7eb; }
}

/* ─── Photos (multi-photo per finding) ─── */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 8px; }
.photo-thumb { position: relative; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; background: #0a1422; border: 1px solid var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-remove { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; border: none; cursor: pointer; font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.photo-remove:hover { background: var(--danger, #c23); }
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-btn { cursor: pointer; }
.photo-btn input { display: none; }

/* ─── Checklist (inline form section) ─── */
.checklist-block { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 18px; }
.checklist-item { background: #0a1422; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.checklist-item-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.checklist-item-label { font-weight: 600; flex: 1; min-width: 220px; }
.checklist-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.chk-pill { background: transparent; border: 1.5px solid var(--line); color: var(--muted-2); padding: 5px 11px; border-radius: 14px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s; }
.chk-pill:hover { border-color: var(--gold, #c9a84c); }
.chk-pill.chk-pass.active { background: rgba(39,174,96,.22); border-color: #27AE60; color: #27AE60; }
.chk-pill.chk-fail.active { background: rgba(231,76,60,.22); border-color: #E74C3C; color: #E74C3C; }
.chk-pill.chk-na.active   { background: rgba(245,158,11,.22); border-color: #F59E0B; color: #F59E0B; }
.chk-pill.chk-pending.active { background: rgba(168,187,207,.18); border-color: #A8BBCF; color: #A8BBCF; }
.checklist-note { width: 100%; margin-top: 8px; background: transparent; border: 1px dashed var(--line); border-radius: 6px; padding: 6px 10px; color: inherit; font-size: 13px; }
.checklist-row { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.checklist-row:last-child { border-bottom: 0; }

/* ─── Template builder ─── */
.template-item-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.template-item-num { color: var(--muted-2); font-size: 12px; min-width: 22px; }
.template-item-input { flex: 1; background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; color: inherit; font-size: 14px; }
