@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@400;600;700;800&family=Rubik:wght@400;500;700&display=swap');

:root {
  --navy-900: #0F172A;
  --navy-800: #131D30;
  --navy-700: #1A2740;
  --navy-600: #263752;
  --navy-500: #3D4F6F;
  --navy-400: #5D7093;
  --navy-300: #8B9AB6;
  --navy-200: #B9C3D5;
  --navy-100: #DCE1EA;
  --navy-50: #EEF1F6;
  --gold-600: #B8912A;
  --gold-500: #D4AF37;
  --gold-400: #E2BD4D;
  --gold-100: #FAF0D3;
  --gold-50: #FDF8EC;
  --danger: #B3362B;
  --ok: #1E7A4C;
  --ink: var(--navy-900);
  --muted: var(--navy-500);
  --border: var(--navy-100);
  --bg: #FAFAF9;
  --white: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: 'Assistant', sans-serif; background: var(--bg); color: var(--ink);
  min-height: 100vh;
}

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: var(--white); border-radius: 16px; padding: 36px; width: 100%; max-width: 360px;
  box-shadow: 0 12px 40px rgba(15,23,42,0.12); text-align: center;
}
.login-box h1 { font-size: 1.3rem; margin: 0 0 20px; color: var(--navy-900); display: flex; align-items: center; justify-content: center; gap: 10px; }
.login-box .login-logo { height: 32px; display: block; }
header.topbar .topbar-logo { height: 28px; display: block; border-radius: 6px; }
.login-box input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 0.95rem; font-family: inherit; margin-bottom: 14px;
}
.login-box button {
  width: 100%; padding: 11px; border: none; border-radius: 9px; background: var(--navy-900);
  color: var(--gold-400); font-weight: 700; font-size: 0.95rem; cursor: pointer;
}
.login-box button:hover { background: var(--navy-700); }
.login-error { color: var(--danger); font-size: 0.85rem; margin-bottom: 10px; min-height: 1.2em; }

header.topbar {
  background: var(--navy-900); color: var(--white); padding: 16px 40px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  box-sizing: border-box;
}
header.topbar h1 { font-size: 1.1rem; margin: 0; white-space: nowrap; flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
nav.tabs { display: flex; gap: 6px; }
nav.tabs button {
  background: transparent; border: none; color: var(--navy-200); padding: 9px 16px;
  border-radius: 9px; font-family: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
nav.tabs button.active { background: var(--gold-500); color: var(--navy-900); }
nav.tabs button:hover:not(.active) { background: var(--navy-700); color: var(--white); }
#logoutBtn {
  background: transparent; border: 1px solid var(--navy-600); color: var(--navy-200);
  padding: 8px 14px; border-radius: 9px; font-family: inherit; cursor: pointer;
}

main { max-width: 1100px; margin: 0 auto; padding: 24px; }
.card {
  background: var(--white); border-radius: 14px; padding: 22px; box-shadow: 0 2px 10px rgba(15,23,42,0.06);
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 1.1rem; color: var(--navy-900); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--navy-700); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.9rem; font-family: inherit; margin-bottom: 12px; background: var(--white); color: var(--ink);
}

button.btn {
  border: none; border-radius: 8px; padding: 9px 18px; font-size: 0.88rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.btn-primary { background: var(--navy-900); color: var(--gold-400); }
.btn-primary:hover { background: var(--navy-700); }
.btn-gold { background: var(--gold-500); color: var(--navy-900); }
.btn-gold:hover { background: var(--gold-400); }
.btn-ghost { background: var(--navy-50); color: var(--navy-700); }
.btn-ghost:hover { background: var(--navy-100); }
.btn-sm { padding: 5px 11px; font-size: 0.78rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--border); }
th { color: var(--navy-500); font-weight: 600; font-size: 0.78rem; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--navy-50); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; }
.badge-active, .badge-paid, .badge-sent { background: #e4f3ea; color: var(--ok); }
.badge-cancelled, .badge-unpaid, .badge-failed { background: #fbe9e7; color: var(--danger); }
.badge-waived { background: var(--gold-100); color: var(--gold-600); }

.stat-tile { background: var(--navy-50); border-radius: 12px; padding: 16px; text-align: center; }
.stat-tile .num { font-size: 1.6rem; font-weight: 800; color: var(--navy-900); }
.stat-tile .lbl { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-bottom: 16px; }
.detail-grid .k { font-size: 0.76rem; color: var(--muted); }
.detail-grid .v { font-size: 0.92rem; font-weight: 600; }
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: flex; align-items: center;
  justify-content: center; padding: 16px; z-index: 50;
}
.modal-box { background: var(--white); border-radius: 14px; padding: 24px; max-width: 560px; width: 100%; max-height: 85vh; overflow-y: auto; }
.chart-wrap { position: relative; height: 260px; }

/* Ported from the wizard (index.html) — used by the agent dashboard's garage/appraiser lookup
   modal, which was missing these entirely (rows had no separation and bled into each other). */
.search-row { display: flex; gap: 10px; margin-bottom: 14px; }
.search-row input { flex: 1; margin-bottom: 0; }
.region-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.region-tab {
  font-family: inherit; font-size: 0.78rem; font-weight: 600; color: var(--navy-700);
  background: var(--navy-50); border: 1px solid var(--navy-100); border-radius: 999px;
  padding: 6px 14px; cursor: pointer; transition: all 0.15s;
}
.region-tab:hover { border-color: var(--gold-400); }
.region-tab.active { background: var(--navy-900); border-color: var(--navy-900); color: var(--gold-400); }
.list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; margin-bottom: 14px; }
.list-item {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.list-item .name { font-weight: 700; font-size: 0.92rem; }
.list-item .loc { font-size: 0.78rem; color: var(--muted); }
.list-item .region-tag {
  background: var(--navy-50); color: var(--navy-600); font-size: 0.68rem; font-weight: 700;
  border-radius: 6px; padding: 2px 7px; white-space: nowrap; flex-shrink: 0;
}
.empty-note { color: var(--muted); font-size: 0.88rem; background: var(--navy-50); border-radius: 10px; padding: 16px; text-align: center; }
.muted { color: var(--muted); font-size: 0.85rem; }
.error-msg { color: var(--danger); font-size: 0.85rem; margin: 6px 0; }
