/* ── Findr tracker app ─────────────────────────────────────────── */

body { overflow: hidden; }

[hidden] { display: none !important; }

.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--pine);
  color: #eef5f3;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 0.9rem;
  gap: 0.4rem;
}

.sidebar .brand {
  color: #fff;
  padding: 0.3rem 0.6rem 1.1rem;
  font-size: 1.25rem;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  border: none;
  background: transparent;
  color: #b7cdc7;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.62rem 0.75rem;
  border-radius: var(--radius-md);
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.side-link:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }

.side-link.active { background: rgba(228, 87, 46, 0.18); color: #fff; }

.side-link.active .side-ico { color: var(--route); }

.side-ico { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 0.4rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-foot .side-link { font-size: 0.84rem; }

/* Main area */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--contour);
  background: rgba(255, 255, 255, 0.65);
}

.topbar h1 { font-size: 1.35rem; font-weight: 600; }

.search-box {
  margin-left: auto;
  position: relative;
}

.search-box input {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.55rem 0.9rem 0.55rem 2.2rem;
  border: 1px solid var(--contour);
  border-radius: var(--radius-md);
  background: var(--paper);
  width: 240px;
  color: var(--pine);
}

.search-box svg {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mist);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.12s ease;
}

.btn-route { background: var(--route); color: #fff; }
.btn-route:hover { background: var(--route-deep); }

.btn-quiet {
  background: transparent;
  color: var(--pine-soft);
  border: 1px solid var(--contour);
}
.btn-quiet:hover { background: rgba(20, 51, 46, 0.05); }

/* Views */
.view { flex: 1; overflow: auto; padding: 1.3rem 1.5rem; }

.view[hidden] { display: none; }

/* Board */
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(248px, 1fr);
  gap: 0.9rem;
  align-items: start;
  min-height: 100%;
}

.col { min-width: 0; }

.col-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.3rem 0.7rem;
}

.col-head .dot { width: 9px; height: 9px; border-radius: 50%; }

.col-head h2 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--pine-soft);
}

.col-head .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--mist);
}

.col-body {
  display: grid;
  gap: 0.6rem;
  min-height: 120px;
  padding: 0.4rem;
  border-radius: var(--radius-md);
  border: 1.5px dashed transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.col-body.drag-over {
  border-color: var(--route);
  background: rgba(228, 87, 46, 0.05);
}

.job-card {
  background: var(--paper);
  border: 1px solid var(--contour);
  border-left: 3px solid var(--stage-color, var(--contour));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 0.8rem 0.9rem;
  cursor: grab;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.job-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-pop); }

.job-card.dragging { opacity: 0.45; cursor: grabbing; }

.job-top { display: flex; gap: 0.65rem; align-items: flex-start; }

.monogram {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--pine);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.job-title { font-weight: 600; font-size: 0.92rem; line-height: 1.25; }

.job-company { font-size: 0.8rem; color: var(--mist); }

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  background: var(--porcelain);
  border: 1px solid var(--contour);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  color: var(--pine-soft);
  white-space: nowrap;
}

.chip.salary { color: var(--brass); border-color: rgba(200, 155, 60, 0.4); }

.job-date {
  margin-top: 0.55rem;
  font-size: 0.7rem;
  color: var(--mist);
}

.col-empty {
  font-size: 0.8rem;
  color: var(--mist);
  text-align: center;
  padding: 1.2rem 0.5rem;
  border: 1.5px dashed var(--contour);
  border-radius: var(--radius-md);
}

/* Contacts view */
.table-wrap {
  background: var(--paper);
  border: 1px solid var(--contour);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

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

th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mist);
  text-align: left;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--contour);
}

td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--contour);
  font-size: 0.9rem;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr:hover { background: var(--porcelain); }

.cell-person { display: flex; align-items: center; gap: 0.7rem; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--pine);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.cell-person b { display: block; font-size: 0.9rem; }
.cell-person span { font-size: 0.76rem; color: var(--mist); }

td .muted { color: var(--mist); font-size: 0.84rem; }

.row-actions { display: flex; gap: 0.3rem; justify-content: flex-end; }

.icon-btn {
  border: none;
  background: transparent;
  color: var(--mist);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
}

.icon-btn:hover { background: var(--porcelain); color: var(--pine); }

.icon-btn.danger:hover { color: var(--route); }

/* Insights view */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.stat-tile {
  background: var(--paper);
  border: 1px solid var(--contour);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.1rem 1.2rem;
}

.stat-tile .num {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-tile .lbl {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--mist);
  margin-top: 0.45rem;
}

.stat-tile.accent .num { color: var(--route); }
.stat-tile.gold .num { color: var(--brass); }

.panel {
  background: var(--paper);
  border: 1px solid var(--contour);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.3rem 1.4rem;
}

.panel h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 1rem; }

.insights-cols { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 1rem; }

.funnel-row { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.75rem; }

.funnel-row .flabel {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pine-soft);
  width: 110px;
  flex-shrink: 0;
}

.funnel-track {
  flex: 1;
  height: 22px;
  background: var(--porcelain);
  border-radius: 999px;
  overflow: hidden;
}

.funnel-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
  transition: width 0.4s ease;
}

.funnel-row .fcount {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  width: 28px;
  text-align: right;
  color: var(--pine);
}

.recent-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--contour);
  font-size: 0.86rem;
  align-items: baseline;
}

.recent-item:last-child { border-bottom: none; }

.recent-item .when {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--mist);
  flex-shrink: 0;
  width: 64px;
}

.recent-item b { font-weight: 600; }

.recent-item .muted { color: var(--mist); }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 51, 46, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 1rem;
}

.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 1.6rem;
}

.modal h2 { font-size: 1.3rem; font-weight: 600; margin-bottom: 1.2rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }

.form-field { display: grid; gap: 0.3rem; }

.form-field.full { grid-column: 1 / -1; }

.form-field label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--pine-soft);
}

.form-field input,
.form-field select,
.form-field textarea {
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--pine);
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--contour);
  border-radius: var(--radius-md);
  background: var(--porcelain);
  width: 100%;
}

.form-field textarea { resize: vertical; min-height: 80px; }

.modal-actions {
  display: flex;
  gap: 0.7rem;
  justify-content: flex-end;
  margin-top: 1.4rem;
}

.modal-actions .danger-zone { margin-right: auto; }

.btn-danger {
  background: transparent;
  border: 1px solid rgba(228, 87, 46, 0.45);
  color: var(--route);
}
.btn-danger:hover { background: rgba(228, 87, 46, 0.08); }

/* Empty states */
.empty-view {
  text-align: center;
  color: var(--mist);
  padding: 4rem 1rem;
}

.empty-view h3 { font-size: 1.2rem; font-weight: 600; color: var(--pine-soft); margin-bottom: 0.5rem; }

/* Toast */
.toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--pine);
  color: #fff;
  font-size: 0.88rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  box-shadow: var(--shadow-pop);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* Responsive */
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 64px 1fr; }
  .sidebar .brand span, .side-link .txt { display: none; }
  .sidebar { padding: 1rem 0.5rem; }
  .side-link { justify-content: center; padding: 0.6rem; }
  .search-box input { width: 150px; }
  .board { grid-auto-columns: 240px; }
  .insights-grid { grid-template-columns: repeat(2, 1fr); }
  .insights-cols { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Map view */
.map-wrap {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.1rem;
  height: 100%;
  min-height: 0;
}

.map-canvas {
  border: 1px solid var(--contour);
  border-radius: var(--radius-lg);
  min-height: 420px;
  height: 100%;
  z-index: 0; /* keep Leaflet panes under modals and the topbar */
}

.leaflet-container { font-family: inherit; }

.map-side {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-height: 0;
}

.map-note { font-size: 0.85rem; margin: 0 0 0.3rem; }

.map-job {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-top: 1px solid var(--contour);
  padding: 0.55rem 0.1rem;
  cursor: pointer;
  font: inherit;
  color: var(--pine);
}

.map-job:hover b { color: var(--route); }
.map-job b { font-size: 0.92rem; font-weight: 600; }
.map-job .muted { font-size: 0.8rem; }

.map-pop { min-width: 190px; }
.map-pop-loc {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mist);
  margin-bottom: 0.35rem;
}

.map-pop-job {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-top: 1px solid var(--contour);
  padding: 0.45rem 0;
  cursor: pointer;
  font: inherit;
  color: var(--pine);
}

.map-pop-job:hover b { color: var(--route); }
.map-pop-job b { font-size: 0.88rem; font-weight: 600; }
.map-pop-job span { font-size: 0.76rem; color: var(--mist); }

@media (max-width: 860px) {
  .map-wrap { grid-template-columns: 1fr; grid-template-rows: minmax(320px, 1fr) auto; }
}
