/* Real Estate Management & Trading — interface styles */

:root {
  color-scheme: light;

  --bg:            #f6f6f4;
  --surface:       #ffffff;
  --surface-2:     #fbfbf9;
  --surface-sunk:  #f1f1ee;
  --line:          #e2e1dc;
  --line-strong:   #cfcec7;

  --ink:           #1b1b19;
  --ink-2:         #56554f;
  --ink-3:         #86857d;

  --accent:        #1f6f4f;
  --accent-soft:   #e8f2ec;
  --accent-ink:    #14523a;

  --danger:        #b23b2e;
  --danger-soft:   #fbeceb;
  --warn:          #9a6512;
  --warn-soft:     #fbf2e2;
  --info:          #2c5c93;
  --info-soft:     #e9f0f8;
  --violet:        #6b4a9c;
  --violet-soft:   #f0ebf8;

  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 1px 2px rgba(20,20,18,.05), 0 4px 14px rgba(20,20,18,.04);

  --sidebar-w:     236px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:           #16171a;
    --surface:      #1e1f23;
    --surface-2:    #232429;
    --surface-sunk: #191a1e;
    --line:         #303137;
    --line-strong:  #414249;
    --ink:          #ecebe7;
    --ink-2:        #a9a8a2;
    --ink-3:        #7c7b76;
    --accent:       #4fb389;
    --accent-soft:  #182b23;
    --accent-ink:   #7fd3ac;
    --danger:       #e0796b;
    --danger-soft:  #33211f;
    --warn:         #d6a45c;
    --warn-soft:    #2e2617;
    --info:         #79aae4;
    --info-soft:    #1a2431;
    --violet:       #ab8ed6;
    --violet-soft:  #262032;
    --shadow:       0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.2);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }

/* ---------- Shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.brand__mark {
  display: flex; align-items: center; gap: 9px;
  font-weight: 650; font-size: 14px; color: var(--ink);
}
.brand__mark:hover { text-decoration: none; }
.brand__dot {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; letter-spacing: -0.03em;
  flex: none;
}
.brand__sub { margin-top: 3px; font-size: 11px; color: var(--ink-3); }

.nav { padding: 12px 10px; flex: 1; }
.nav__group { margin-bottom: 16px; }
.nav__label {
  font-size: 10px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-3);
  padding: 0 8px 6px;
}
.nav__link {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 13px; font-weight: 500;
}
.nav__link:hover { background: var(--surface-sunk); color: var(--ink); text-decoration: none; }
.nav__link.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav__link svg { width: 15px; height: 15px; flex: none; opacity: .8; }

.sidebar__foot {
  border-top: 1px solid var(--line);
  padding: 12px;
}
.who { display: flex; gap: 9px; align-items: center; }
.who__av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-sunk); color: var(--ink-2);
  display: grid; place-items: center; font-size: 11px; font-weight: 650;
  flex: none;
}
.who__name { font-size: 12px; font-weight: 600; line-height: 1.3; }
.who__role { font-size: 11px; color: var(--ink-3); }

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

.topbar {
  height: 54px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 20;
}
.topbar__title { font-size: 15px; font-weight: 600; }
.topbar__crumb { font-size: 12px; color: var(--ink-3); }
.topbar__spacer { flex: 1; }
/* Scoped to .topbar so it outranks `.btn { display: inline-flex }`, which is
   the same specificity but declared later and was therefore winning — leaving
   the hamburger visible on desktop, where the sidebar is always on screen and
   there is nothing for it to open. */
.topbar .menu-toggle { display: none; }

.content { padding: 20px; max-width: 1400px; width: 100%; }

/* ---------- Cards & sections ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.card__head {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.card__head h2 { flex: 1; }
.card__hint { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.card__body { padding: 16px; }
.card__body--flush { padding: 0; }
.card__foot {
  padding: 11px 16px; border-top: 1px solid var(--line);
  background: var(--surface-2); font-size: 12px; color: var(--ink-2);
}

.page-head {
  display: flex; align-items: flex-start; gap: 14px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.page-head__text { flex: 1; min-width: 220px; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }

/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat__label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-3);
}
.stat__value { font-size: 22px; font-weight: 650; margin-top: 5px; letter-spacing: -0.02em; }
.stat__meta { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.stat--accent .stat__value { color: var(--accent); }
.stat--danger .stat__value { color: var(--danger); }
.stat--info  .stat__value { color: var(--info); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-size: 11px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-3);
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tfoot td {
  padding: 10px 12px; font-weight: 650;
  border-top: 2px solid var(--line-strong); background: var(--surface-2);
}
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.strong { font-weight: 650; }

.empty {
  padding: 34px 20px; text-align: center; color: var(--ink-3);
}
.empty__title { font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge--neutral, .badge--grey { background: var(--surface-sunk); color: var(--ink-2); border-color: var(--line); }
.badge--green  { background: var(--accent-soft); color: var(--accent-ink); }
.badge--amber  { background: var(--warn-soft);   color: var(--warn); }
.badge--orange { background: var(--warn-soft);   color: var(--warn); }
.badge--blue   { background: var(--info-soft);   color: var(--info); }
.badge--violet { background: var(--violet-soft); color: var(--violet); }
.badge--red    { background: var(--danger-soft); color: var(--danger); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-sunk); text-decoration: none; }
.btn--primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn--primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn--danger { color: var(--danger); border-color: var(--line-strong); }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn--sm { padding: 4px 9px; font-size: 12px; }
.btn--link {
  border: 0; background: none; padding: 2px 4px; color: var(--accent-ink);
}
.btn--link:hover { text-decoration: underline; background: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field__hint { font-size: 11px; color: var(--ink-3); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], input[type=tel], input[type=file],
select, textarea {
  width: 100%;
  padding: 7px 10px;
  font: inherit; font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
textarea { min-height: 76px; resize: vertical; }
input[type=file] { padding: 6px; background: var(--surface-sunk); }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.check input { width: auto; }

.fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  margin-bottom: 16px;
}
.fieldset > legend {
  font-size: 11px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3);
  padding: 0 6px;
}

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
}
.filters .field { min-width: 140px; }
.filters .field--grow { flex: 1; min-width: 200px; }

/* ---------- Flash ---------- */

.flash {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  margin-bottom: 14px; font-size: 13px;
}
.flash--success { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.flash--error   { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.flash--info    { background: var(--info-soft);   border-color: var(--info);   color: var(--info); }

/* ---------- Definition rows ---------- */

.defs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.def { background: var(--surface); padding: 11px 14px; }
.def__k {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-3); margin-bottom: 3px;
}
.def__v { font-size: 14px; font-weight: 550; word-break: break-word; }
.def__v--lg { font-size: 17px; font-weight: 650; }

/* Side-by-side comparison (circle vs market value) */
.compare {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.compare__cell {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; background: var(--surface-2);
}
.compare__label {
  font-size: 11px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-3);
}
.compare__value { font-size: 20px; font-weight: 650; margin-top: 4px; }
.compare__meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---------- Tabs ---------- */

.tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.tabs a {
  padding: 8px 13px; font-size: 13px; font-weight: 550;
  color: var(--ink-2); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.is-active { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* ---------- Timeline ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 16px 22px;
  border-left: 2px solid var(--line);
  margin-left: 5px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ''; position: absolute; left: -6px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-strong);
}
.timeline li.is-current::before { background: var(--accent); border-color: var(--accent); }
.timeline__head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.timeline__date { font-size: 12px; color: var(--ink-3); }
.timeline__body { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

/* ---------- Progress ---------- */

.bar {
  height: 6px; border-radius: 3px; background: var(--surface-sunk);
  overflow: hidden; display: flex; min-width: 90px;
}
.bar__sold { background: var(--ink-3); }
.bar__reserved { background: var(--warn); }
.bar__free { background: var(--accent); }

/* ---------- Login ---------- */

.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background: var(--bg); padding: 24px;
}
.login {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.login__brand {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.login h1 { font-size: 18px; margin-top: 16px; }
.login p.lead { color: var(--ink-2); font-size: 13px; margin: 4px 0 20px; }
.login .field { margin-bottom: 13px; }
.login .btn { width: 100%; justify-content: center; padding: 9px; }
.login__foot {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-3); text-align: center;
}

/* ---------- Error page ---------- */

.error-page {
  min-height: 60vh; display: grid; place-items: center; padding: 40px 20px; text-align: center;
}
.error-page h1 { font-size: 22px; margin-bottom: 8px; }
.error-page p { color: var(--ink-2); max-width: 460px; margin: 0 auto 18px; }

/* ---------- Utilities ---------- */

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.hr { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
.inline-form { display: inline; }

@media (max-width: 980px) {
  .grid-2, .compare { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .sidebar {
    position: fixed; z-index: 40; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.2);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after {
    content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30;
  }
  .topbar .menu-toggle { display: inline-flex; }
  .content { padding: 14px; }
}

@media print {
  .sidebar, .topbar, .btn, .filters, .no-print { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* ---------- Upload progress ---------- */

.uploading { display: none; margin-top: 12px; }
.uploading.is-on { display: block; }

.uploading__bar {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: var(--line); border: 1px solid var(--line);
}
.uploading__bar span {
  display: block; height: 100%; width: 0;
  background: var(--accent);
  transition: width .18s linear;
}
.uploading__text {
  margin-top: 7px; font-size: 13px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
