/* ============================================================
   DealNav clone — styles
   ============================================================ */
:root {
  --bg: #eceef0;
  --card: #ffffff;
  --sidebar: #14313d;
  --sidebar-2: #102832;
  --sidebar-text: #aebcc4;
  --sidebar-active: #ffffff;
  --primary: #15323e;
  --primary-hover: #1d4453;
  --blue: #2563eb;
  --blue-soft: #e8f0fe;
  --border: #e4e7eb;
  --border-strong: #d3d8dd;
  --text: #1f2a33;
  --muted: #6b7785;
  --muted-2: #95a0aa;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,40,50,.06), 0 1px 3px rgba(16,40,50,.05);
  --shadow-lg: 0 10px 40px rgba(16,40,50,.18);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: 78px; flex-shrink: 0;
  background: var(--sidebar);
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 8px; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar.collapsed { width: 78px; }
.side-logo { color: #fff; font-weight: 800; font-size: 15px; margin: 6px 0 14px; letter-spacing: .2px; }
.side-logo .n { color: #5fd0c5; }
.nav-item {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 4px; border-radius: 10px; color: var(--sidebar-text);
  font-size: 11px; font-weight: 500; background: none; border: none; transition: .15s;
}
.nav-item svg { width: 20px; height: 20px; stroke: currentColor; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: #fff; color: var(--primary); }
.nav-sep { width: 40px; height: 1px; background: rgba(255,255,255,.12); margin: 8px 0; }
.nav-spacer { flex: 1; }
.nav-collapse { color: var(--sidebar-text); background: none; border: none; padding: 8px; }

/* ---------- Topbar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 22px; position: sticky; top: 0; z-index: 40;
}
.topbar .brand { font-weight: 800; font-size: 18px; color: var(--primary); }
.topbar .brand .n { color: #2bb3a3; }
.search {
  flex: 0 1 420px; display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 22px; padding: 7px 14px;
}
.search svg { width: 16px; height: 16px; color: var(--muted); }
.search .scope {
  display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 13px;
  border-right: 1px solid var(--border); padding-right: 8px;
}
.search input { border: none; outline: none; flex: 1; background: none; color: var(--text); }
.topbar .spacer { flex: 1; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 9px; padding: 8px 14px;
  font-weight: 600; font-size: 13px; border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  transition: .15s;
}
.btn:hover { background: #f6f7f8; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); border-radius: 20px; padding: 9px 18px; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.user-chip { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; }
.user-chip .gear { color: var(--muted); display: flex; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #1d4453 0%, #14313d 45%, #0e2630 100%); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  padding: 32px 30px 26px; }
.login-brand { font-size: 26px; font-weight: 800; color: var(--primary); text-align: center; }
.login-brand .n { color: #2bb3a3; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 4px 0 22px; }
.login-card .field label { font-size: 12px; }
.login-card .input { padding: 11px 12px; }
.login-card .btn-primary { margin-top: 6px; padding: 11px; font-size: 14px; }
.login-err { background: #fde2e2; color: #c0392b; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 16px; font-weight: 500; }
.login-or { display: flex; align-items: center; text-align: center; color: var(--muted-2); font-size: 12px; margin: 18px 0; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-or span { padding: 0 12px; }
.google-btn { width: 100%; justify-content: center; padding: 11px; font-weight: 600; background: #fff; }
.google-btn:hover { background: #f6f7f8; }
.login-foot { text-align: center; color: var(--muted-2); font-size: 12px; margin-top: 20px; }

/* dropdown menu (Create New / user) */
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 190px; z-index: 60;
}
.menu-pop button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  background: none; border: none; color: var(--text); font-size: 13px; text-align: left;
}
.menu-pop button:hover { background: #f3f5f6; }
.menu-pop svg { width: 16px; height: 16px; color: var(--muted); }

/* ---------- Page content ---------- */
.content { padding: 22px; flex: 1; }
.page-pad { padding: 0; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; }
.card-title { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; }
.card-title svg { width: 18px; height: 18px; color: var(--primary); }
.pill-count { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: #eef1f3; border-radius: 14px; padding: 3px 10px; }
.pill-count svg { width: 13px; height: 13px; }

/* ---------- Dashboard ---------- */
.dash-map { height: 460px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); position: relative; box-shadow: var(--shadow); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

.map-layers {
  position: absolute; right: 14px; bottom: 14px; z-index: 500; background: #fff;
  border-radius: 9px; box-shadow: var(--shadow-lg); padding: 7px 11px; display: flex; gap: 14px; font-size: 12px; font-weight: 600;
}
.map-layers label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.map-layers .ic { display: inline-flex; }
.map-layers input { accent-color: var(--blue); }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 18px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl th.sortable { cursor: pointer; }
.tbl th .arrow { opacity: .5; margin-left: 4px; }
.tbl td { padding: 13px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr.clickable:hover { background: #f7f9fa; cursor: pointer; }
.tbl .empty { text-align: center; color: var(--muted-2); padding: 38px 0; font-style: normal; }
.cell-strong { font-weight: 600; }
.cell-muted { color: var(--muted); }
.checkbox-cell { width: 38px; }

/* full list page header */
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.list-title { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; }
.list-title svg { width: 22px; height: 22px; color: var(--primary); }
.list-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.list-search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border-strong); border-radius: 9px; padding: 7px 12px; min-width: 230px; }
.list-search svg { width: 15px; height: 15px; color: var(--muted); }
.list-search input { border: none; outline: none; flex: 1; background: none; }
.pager { padding: 14px 4px; color: var(--muted); font-size: 13px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-gray   { background: #eef1f3; color: #51606b; }
.badge-amber  { background: #fef0cf; color: #976a08; }
.badge-blue   { background: #e0ebfe; color: #1f5fd6; }
.badge-indigo { background: #e7e7fd; color: #4f46e5; }
.badge-purple { background: #f0e6fd; color: #7c3aed; }
.badge-teal   { background: #d7f3ee; color: #0f8a78; }
.badge-green  { background: #d8f1de; color: #1f8a45; }
.badge-red    { background: #fde2e2; color: #c0392b; }
.badge-orange { background: #ffe7d1; color: #c2620e; }
.prio { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.prio .dot { width: 8px; height: 8px; border-radius: 50%; }
.prio-High .dot { background: #e23b3b; } .prio-High { color: #c0392b; }
.prio-Medium .dot { background: #e8a13a; } .prio-Medium { color: #b87514; }
.prio-Low .dot { background: #56b06a; } .prio-Low { color: #3b8a52; }

/* ---------- Detail page ---------- */
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.detail-head h1 { font-size: 22px; font-weight: 800; margin: 0; flex: 1; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid var(--border-strong); background: #fff; color: var(--muted); }
.icon-btn:hover { background: #f5f6f7; }
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 1100px){ .detail-grid { grid-template-columns: 1fr; } }
.detail-map { height: 280px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); position: relative; }
.section { padding: 20px; }
.section h3 { margin: 0 0 16px; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section h3 svg { width: 17px; height: 17px; color: var(--primary); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field .req { color: #e23b3b; }
.input, .select, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 9px; background: #fbfcfc; color: var(--text); outline: none;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--blue); background: #fff; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-static { padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: #f8f9fa; color: var(--muted); }
.link-chip { display: inline-flex; align-items: center; gap: 7px; background: #eef3fb; color: var(--blue); border-radius: 7px; padding: 5px 10px; font-weight: 600; font-size: 13px; }
.tag-chip { display: inline-flex; align-items: center; gap: 6px; background: #eef1f3; color: #51606b; border-radius: 7px; padding: 4px 10px; font-size: 12px; font-weight: 600; margin: 0 6px 6px 0; }

.activity-tabs { display: flex; gap: 4px; background: #eef1f3; padding: 4px; border-radius: 10px; margin-bottom: 14px; }
.activity-tabs button { flex: 1; padding: 8px; border: none; background: none; border-radius: 7px; font-weight: 600; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 7px; }
.activity-tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.activity-item { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.activity-dot svg { width: 15px; height: 15px; }
.activity-body { flex: 1; }
.activity-meta { font-size: 12px; color: var(--muted-2); margin-top: 3px; }
.note-box { display: flex; gap: 10px; margin-top: 12px; }
.empty-soft { color: var(--muted-2); text-align: center; padding: 22px 0; }
.contact-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 8px; }
.contact-row .avatar2 { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.contact-row .meta { font-size: 12px; color: var(--muted); }
.detail-footer { text-align: center; color: var(--muted-2); font-size: 12px; padding: 22px 0 4px; }
.subhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.subhead .lbl { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.mini-add { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text); border: 1px solid var(--border-strong); background: #fff; border-radius: 7px; padding: 5px 9px; }
.mini-add svg { width: 13px; height: 13px; }

/* ---------- Slide-over panel ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20,35,45,.42); z-index: 100; opacity: 0; transition: opacity .2s; }
.overlay.show { opacity: 1; }
.panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: 540px; max-width: 94vw; background: var(--bg);
  z-index: 101; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.panel.show { transform: translateX(0); }
.panel-h { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; }
.panel-h h2 { margin: 0; font-size: 19px; font-weight: 800; }
.panel-body { flex: 1; overflow-y: auto; padding: 0 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.panel-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.panel-card h4 { margin: 0 0 14px; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.panel-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg); }
.type-toggle { display: flex; gap: 8px; }
.type-toggle button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 10px; border-radius: 9px; border: 1px solid var(--border-strong); background: #fff; font-weight: 600; color: var(--muted); }
.type-toggle button svg { width: 16px; height: 16px; }
.type-toggle button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.inline-add { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text); border: 1px solid var(--border-strong); background: #fff; border-radius: 7px; padding: 6px 10px; }
.multi-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.multi-row .select { max-width: 110px; }
.x-btn { border: none; background: none; color: var(--muted-2); padding: 6px; border-radius: 6px; }
.x-btn:hover { background: #f0f1f2; color: #e23b3b; }
.panel-map { height: 180px; border-radius: 9px; overflow: hidden; border: 1px solid var(--border); margin-top: 10px; }
.hint { font-size: 12px; color: var(--muted-2); margin-top: 6px; }

/* spinner / skeleton */
.skel { background: linear-gradient(90deg,#e7eaec 25%,#eef1f3 50%,#e7eaec 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.skel-row { height: 44px; margin-bottom: 10px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 200; font-weight: 600; font-size: 13px; opacity: 0; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* leaflet popup tweaks */
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; }
.leaflet-popup-content b { display: block; margin-bottom: 2px; }
.lp-link { color: var(--blue); font-weight: 600; margin-top: 4px; display: inline-block; }
.marker-pin { width: 16px; height: 16px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,.35); }
