:root {
  --gold: #C29324;
  --gold-d: #9A7418;
  --navy: #1B1F4B;
  --bg: #F6F4EE;
  --card: #fff;
  --line: #E4E0D3;
  --ink: #23264A;
  --muted: #6B6F8F;
  --ok: #0B7F72;
  --err: #B8341E;
  --warn: #8A5F00
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  min-height: 100vh
}

a {
  color: var(--gold-d)
}

.side {
  width: 240px;
  background: var(--navy);
  flex: none;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto
}

.brand {
  display: block;
  margin: 0 auto 18px;
  width: 140px
}

.brand img {
  width: 100%;
  display: block
}

.side nav a {
  display: block;
  color: #D5D9F5;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 2px
}

.side nav a:hover {
  background: #2A2F6B
}

.side nav a.on {
  background: var(--gold);
  color: #1B1F4B;
  font-weight: 700
}

.main {
  flex: 1;
  min-width: 0
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line)
}

.top h1 {
  margin: 0;
  font-size: 22px
}

.who {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 14px
}

.who form {
  margin: 0
}

main {
  padding: 24px 28px;
  max-width: 1280px
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px
}

.card.flush {
  padding: 0;
  overflow: auto
}

.pad {
  padding: 16px 20px 0;
  margin: 0
}

.btn {
  display: inline-block;
  background: var(--gold);
  color: #1B1F4B;
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none
}

.btn:hover {
  background: var(--gold-d);
  color: #fff
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink)
}

.btn.danger {
  background: var(--err);
  color: #fff
}

.btn.small {
  padding: 4px 10px;
  font-size: 14px
}

.right {
  margin-left: auto
}

table {
  width: 100%;
  border-collapse: collapse
}

th,
td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top
}

th {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: #FBFAF6
}

tr:last-child td {
  border-bottom: 0
}

.row-actions {
  white-space: nowrap
}

.row-actions form {
  display: inline
}

.muted {
  color: var(--muted)
}

small {
  font-size: 13px
}

.due {
  color: var(--err);
  font-weight: 700
}

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap
}

input,
select,
textarea {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  width: 100%
}

.filters input,
.filters select {
  width: auto
}

.field {
  margin-bottom: 14px
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px
}

.req {
  color: var(--err)
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px
}

.field.wide {
  grid-column: 1/-1
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 8px
}

.form {
  max-width: 860px
}

.inline-form {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap
}

.inline-form input {
  width: auto;
  flex: 1
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0 0 14px;
  padding: 10px 16px
}

legend {
  font-weight: 700;
  padding: 0 6px
}

.check {
  display: block;
  padding: 3px 0;
  font-weight: 400
}

.check input {
  width: auto;
  margin-right: 6px
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 6px solid var(--gold);
  border-radius: 14px;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column
}

.stat.warn {
  border-left-color: var(--err)
}

.stat .n {
  font-size: 30px;
  font-weight: 800
}

.stat .l {
  color: var(--muted);
  font-size: 14px
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px
}

.two.wide-left {
  grid-template-columns: 1.6fr 1fr
}

.bar {
  display: grid;
  grid-template-columns: 110px 1fr 36px;
  gap: 10px;
  align-items: center;
  margin: 8px 0
}

.bar div {
  background: #EFEBDD;
  border-radius: 8px;
  height: 14px
}

.bar i {
  display: block;
  height: 100%;
  background: var(--gold);
  border-radius: 8px
}

.bar b {
  text-align: right
}

.head-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start
}

.facts {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  margin: 0
}

.facts dt {
  color: var(--muted)
}

.facts dd {
  margin: 0
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 16px 0 0
}

.timeline li {
  border-left: 3px solid var(--gold);
  padding: 2px 0 12px 12px
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  background: #E8EAF8;
  color: #2B3070
}

.b-verified,
.b-leased,
.b-signed,
.b-settled,
.b-approved,
.b-active,
.b-available {
  background: #D5F2EE;
  color: #075A51
}

.b-pending,
.b-negotiation,
.b-legal,
.b-legal-check,
.b-hold,
.b-site-visit {
  background: #FBE9C2;
  color: #6B4800
}

.b-rejected,
.b-lost,
.b-cancelled,
.b-disabled,
.b-inactive {
  background: #FFE3DC;
  color: #8E2A16
}

.flash {
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 600
}

.flash.ok {
  background: #D5F2EE;
  color: #075A51
}

.flash.err {
  background: #FFE3DC;
  color: #8E2A16
}

body.login {
  align-items: center;
  justify-content: center;
  background: var(--navy)
}

.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 30px;
  width: min(380px, 92vw)
}

.login-card img {
  width: 170px;
  display: block;
  margin: 0 auto 18px
}

@media (max-width:860px) {
  body {
    flex-direction: column
  }

  .side {
    width: auto;
    height: auto;
    position: static;
    display: flex;
    gap: 10px;
    align-items: center;
    overflow-x: auto
  }

  .side nav {
    display: flex;
    gap: 4px
  }

  .side nav a {
    white-space: nowrap
  }

  .brand {
    width: 70px;
    margin: 0
  }

  .two,
  .two.wide-left,
  .grid {
    grid-template-columns: 1fr
  }

  main {
    padding: 16px
  }
}

/* property photos */
.gallery {
  padding: 14px
}

.g-main {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  background: #eee
}

.g-thumbs {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap
}

.g-thumb {
  width: 90px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer
}

.g-thumb.on {
  border-color: var(--gold)
}

.p-cell {
  display: flex;
  gap: 12px;
  align-items: center
}

.p-thumb {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  flex: none;
  background: #eee
}

.photo-edit {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px
}

.photo-edit figure {
  margin: 0
}

.photo-edit img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin-bottom: 6px
}