:root {
  --bg:        #f7f8fa;
  --panel:     #ffffff;
  --sidebar:   #111214;
  --sidebar-h: #1c1d21;
  --text:      #111214;
  --muted:     #6b7280;
  --border:    #e5e7eb;
  --accent:    #5865f2;
  --accent-h:  #4752c4;
  --danger:    #ef4444;
  --success:   #10b981;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }

a { color: inherit; text-decoration: none; }

/* ── Layout ─────────────────────────────────────── */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────── */
.sidebar {
  background: var(--sidebar); color: #e5e7eb;
  display: flex; flex-direction: column; padding: 16px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 12px; }
.brand-icon { font-size: 22px; }
.brand-name { font-weight: 700; letter-spacing: .3px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: #c7cad1; font-size: 14px;
}
.nav-item:hover { background: var(--sidebar-h); color: #fff; }
.nav-item.active { background: #000; color: #fff; font-weight: 600; }
.nav-icon { width: 20px; display: inline-block; text-align: center; }

.sidebar-footer { border-top: 1px solid #26282c; padding-top: 8px; margin-top: 8px; }

/* ── Content ────────────────────────────────────── */
.content { padding: 32px 40px; max-width: 1400px; }
h1 { margin: 0 0 4px; font-size: 26px; }
.subtitle { color: var(--muted); margin: 0 0 24px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }

/* ── Cards ──────────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; margin-bottom: 20px;
}
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 700; }

/* ── Table ──────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table tr:last-child td { border-bottom: none; }
.table .right { text-align: right; }
.muted { color: var(--muted); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* ── Buttons ────────────────────────────────────── */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 8px; font-size: 14px;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: #111214; color: #fff; }
.btn-primary:hover { background: #000; }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f3f4f6; }
.icon-btn {
  background: transparent; border: none; cursor: pointer;
  font-size: 15px; padding: 6px 8px; border-radius: 6px;
}
.icon-btn:hover { background: #f3f4f6; }

/* ── Forms ──────────────────────────────────────── */
.form { max-width: 900px; }
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-row label { font-weight: 600; font-size: 13px; color: #374151; }
.form-row input, .form-row textarea, .form-row select {
  padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 14px; font-family: inherit; background: #fff;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

/* ── Flashes ────────────────────────────────────── */
.flashes { margin-bottom: 16px; }
.flash {
  padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 14px;
}
.flash-error   { background: #fee2e2; color: #991b1b; }
.flash-success { background: #d1fae5; color: #065f46; }

/* ── Login ──────────────────────────────────────── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--sidebar);
}
.login-card {
  background: #1a1b1f; color: #e5e7eb; padding: 40px;
  border-radius: 14px; width: 340px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .brand-icon { font-size: 34px; }
.login-brand h1 { color: #fff; font-size: 20px; margin: 8px 0 2px; }
.login-brand p { color: #9aa0a8; font-size: 13px; margin: 0; }
.login-card label { display: block; font-size: 13px; margin-bottom: 6px; color: #c7cad1; }
.login-card input {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid #2c2d32; background: #111214; color: #fff;
  margin-bottom: 14px; font-size: 14px;
}
.login-card button {
  width: 100%; padding: 10px; border-radius: 8px; border: none;
  background: var(--accent); color: #fff; font-weight: 600;
  cursor: pointer; font-size: 14px;
}
.login-card button:hover { background: var(--accent-h); }
/* ── Checkboxes in report editor ─────────────── */
.checkbox-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
  padding: 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.cb {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}
.cb input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: #5865f2;
}
.cb span { font-weight: 600; }
.cb small { color: #6b7280; font-size: 12px; margin-left: 4px; }

/* ── Pills for warrant status ────────────────── */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.pill-active   { background: #d1fae5; color: #065f46; }
.pill-inactive { background: #e5e7eb; color: #374151; }
/* ── Role picker ─────────────────────────────── */
.role-picker {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px;
  background: #f9fafb;
}
.role-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.role-item:hover { background: #fff; }
.role-item input { accent-color: #5865f2; }
.role-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.1);
}
/* ── Small buttons ───────────────────────────── */
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}
.neg { color: #ef4444; font-weight: 600; }

/* ── Modal ───────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-overlay[hidden] { display: none !important; }

.modal {
  background: #fff; border-radius: 12px; padding: 22px;
  min-width: 380px; max-width: 520px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.modal-head h3 { margin: 0; }
/* ── Listing cards (properties / vehicle listings) ── */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.listing-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.listing-image {
  height: 160px;
  background: #f3f4f6 center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}
.listing-placeholder { font-size: 44px; opacity: .35; }
.listing-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.listing-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 15px;
}
.listing-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
}
.price { font-weight: 700; font-size: 15px; }
.listing-actions { display: flex; gap: 4px; }
.pill-danger { background: #fee2e2; color: #991b1b; }
/* ── User picker dropdown ──────────────────── */
.up-wrap { position: relative; }
.up-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  max-height: 260px; overflow-y: auto;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  margin-top: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.up-item {
  padding: 10px 12px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #f3f4f6;
}
.up-item:hover { background: #f9fafb; }
.up-name { font-weight: 500; }
.up-meta { color: #6b7280; font-size: 12px; }
.up-empty { padding: 10px 12px; color: #6b7280; }
/* ── Sidebar group titles ───────────────── */
.nav-group-title {
  padding: 14px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #6b7280;
  opacity: 0.9;
}
.nav-group-title:first-child {
  padding-top: 6px;
}