/* Florida AI Partners internal CRM — utilitarian, fast, mobile-first. Light theme. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #16202c;
  --muted: #5b6b7b;
  --line: #e3e8ee;
  --brand: #0b7285;
  --brand-ink: #ffffff;
  --green: #1aa05a;
  --amber: #e0a106;
  --red: #d6453d;
  --rot: #b5651d;
  --shadow: 0 1px 2px rgba(16, 32, 44, 0.06), 0 2px 8px rgba(16, 32, 44, 0.05);
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--brand); text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ── Top bar ───────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 700; letter-spacing: -0.01em; }
.topbar .brand small { color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a {
  padding: 7px 12px; border-radius: 999px; color: var(--muted);
  font-weight: 600; white-space: nowrap;
}
.nav a.active { background: var(--brand); color: var(--brand-ink); }
.nav a:hover:not(.active) { background: #eef2f5; }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.who button { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; color: var(--muted); }

/* ── Layout ────────────────────────────────────────────────────────────── */
.wrap { padding: 16px; max-width: 1400px; margin: 0 auto; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.view-head h1 { font-size: 20px; margin: 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.notice { background: #fff7e6; border: 1px solid #ffe2a8; color: #7a5a00; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; }
.empty { color: var(--muted); padding: 40px 16px; text-align: center; }

/* ── Buttons + inputs ──────────────────────────────────────────────────── */
.btn { background: var(--brand); color: #fff; border: none; border-radius: 10px; padding: 9px 14px; font-weight: 600; }
.btn.secondary { background: #eef2f5; color: var(--ink); }
.btn.ghost { background: none; border: 1px solid var(--line); color: var(--ink); }
.btn.danger { background: var(--red); }
.btn:disabled { opacity: 0.5; cursor: default; }
input, select, textarea {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; }

/* ── Kanban board ──────────────────────────────────────────────────────── */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { background: #eef1f4; border-radius: var(--radius); width: 280px; min-width: 280px; flex-shrink: 0; }
.col.drop { outline: 2px dashed var(--brand); outline-offset: -2px; }
.col-head { padding: 12px 14px 8px; }
.col-head .name { font-weight: 700; }
.col-head .meta { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; margin-top: 2px; }
.col-body { padding: 0 8px 10px; display: flex; flex-direction: column; gap: 8px; min-height: 24px; }

.card {
  background: var(--surface); border-radius: 10px; padding: 11px 12px;
  box-shadow: var(--shadow); border: 1px solid var(--line); cursor: grab;
}
.card:active { cursor: grabbing; }
.card .title { font-weight: 600; }
.card .sub { color: var(--muted); font-size: 13px; }
.card .row { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; gap: 8px; }
.card .val { font-weight: 700; }
.card .stage-move { font-size: 12px; padding: 4px 6px; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.na { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 7px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.badge.rot { background: #f6e7d6; color: var(--rot); }
.badge.owner { background: #e7eef3; color: var(--brand); text-transform: capitalize; }
.badge.status { background: #eef1f4; color: var(--muted); text-transform: capitalize; }
.badge.confidence-high { background: #def0e3; color: var(--green); }
.badge.confidence-med { background: #fbf0d3; color: var(--amber); }
.badge.confidence-low { background: #f4e2e1; color: var(--red); }

/* ── Lists / tables ────────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start;
}
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.item .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.task-check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); background: #fff; flex-shrink: 0; }
.task-check.done { background: var(--green); border-color: var(--green); }

.group-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 16px 0 6px; }
.group-label.overdue { color: var(--red); }

/* ── Detail / timeline ─────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
@media (max-width: 880px) { .detail-grid { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.panel h2 { font-size: 15px; margin: 0 0 10px; }
.kv { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv .k { color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 9px 0 9px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline .when { color: var(--muted); font-size: 12px; }
.timeline .what { font-weight: 600; }
.timeline .prod { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(16,32,44,0.45); display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 560px; padding: 20px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); }
.modal h2 { margin: 0 0 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ── Deal builder service picker ───────────────────────────────────────── */
.svc-cat { font-size: 12px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; text-transform: uppercase; }
.svc { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.svc.on { border-color: var(--brand); background: #f0f8fa; }
.svc .svc-name { font-weight: 600; flex: 1; }
.svc .svc-price { color: var(--muted); font-size: 13px; }
.total-bar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 0; display: flex; justify-content: space-between; align-items: center; font-weight: 700; }

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card p { color: var(--muted); margin: 0 0 18px; }
.login-card .btn { width: 100%; margin-top: 12px; }
.msg { margin-top: 14px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.msg.ok { background: #def0e3; color: #185c33; }
.msg.error { background: #f4e2e1; color: #842029; }
.devlink { word-break: break-all; font-size: 12px; }

/* ── Quick-add ─────────────────────────────────────────────────────────── */
.qa-wrap { max-width: 480px; margin: 0 auto; padding: 16px; }
.qa-big input { font-size: 17px; padding: 14px; }
.qa-queue { margin-top: 14px; font-size: 13px; color: var(--muted); }
.offline-bar { background: var(--amber); color: #3a2c00; text-align: center; padding: 6px; font-size: 13px; font-weight: 600; }

/* ── Polish pass ─────────────────────────────────────────────────────────── */
.btn { transition: filter .15s ease, transform .04s ease, box-shadow .15s ease; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn.secondary:hover { background: #e3e9ee; }
.btn.ghost:hover { background: #f4f7f9; }
.btn:not(.secondary):not(.ghost):not(.danger) { box-shadow: 0 1px 2px rgba(11,114,133,0.25); }
.view-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.topbar { box-shadow: 0 1px 0 rgba(16,32,44,0.05); }
.topbar .brand { font-weight: 800; letter-spacing: -0.02em; }
.nav a { transition: background .12s ease, color .12s ease; }
.item { transition: box-shadow .15s ease, border-color .15s ease, transform .06s ease; }
.item:hover { border-color: #cdd6df; box-shadow: 0 3px 12px rgba(16,32,44,0.09); }
.item .title { letter-spacing: -0.01em; }
.card { transition: box-shadow .15s ease, transform .06s ease; }
.card:hover { box-shadow: 0 4px 16px rgba(16,32,44,0.11); }
.col { background: #edf1f5; border: 1px solid #e6ebf0; }
.col-head .name { letter-spacing: -0.01em; }
.panel { border-radius: 14px; }
.lead-actions { display: flex; align-items: center; }
.lead-pipe { align-self: center; white-space: nowrap; font-size: 13px; padding: 7px 11px; }

/* ── Mobile: give the nav its own full-width row so it's never squeezed ───── */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding: 9px 13px; }
  .topbar .brand { font-size: 15px; }
  .who { order: 2; margin-left: auto; }
  .nav { order: 3; flex: 1 1 100%; }
}

/* ── Sales territories (admin dashboard) ──────────────────────────────────── */
.terr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.terr-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.terr-cap { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }
.terr-card select { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; font: inherit; }
.terr-card .sub { margin: 8px 0 0; font-size: 12px; }
.terr-card .btn { width: 100%; }
.terr-stats { display: flex; gap: 8px; }
.terr-stat { flex: 1; text-align: center; background: var(--bg); border-radius: 9px; padding: 8px 4px; }
.terr-n { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.terr-l { font-size: 12px; color: var(--muted); }
.terr-h2 { font-size: 16px; margin: 8px 0 10px; letter-spacing: -0.01em; }
.terr-h2 .sub { font-weight: 400; }
.terr-regions { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 22px; }
.region-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 13px; box-shadow: var(--shadow); }
.region-head { display: flex; align-items: center; gap: 8px; }
.region-name { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; border: 1px solid transparent; background: transparent; border-radius: 7px; padding: 4px 6px; }
.region-name:hover, .region-name:focus { border-color: var(--line); background: var(--bg); outline: none; }
.region-owner { border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; font: inherit; font-size: 13px; }
.region-del { background: none; border: none; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 7px; }
.region-del:hover { background: #fbe9e7; color: var(--red); }
.region-cities { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 11px; }
.city-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 11px; font-size: 13px; }
.city-chip button { background: none; border: none; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 3px; border-radius: 999px; }
.city-chip button:hover { background: #fbe9e7; color: var(--red); }
.region-add { border: 1px dashed var(--line); border-radius: 999px; padding: 5px 9px; font: inherit; font-size: 13px; color: var(--brand); background: var(--surface); }
.terr-cities { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.city-row { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; }
.city-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.terr-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; max-height: 200px; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; padding: 10px; }
.terr-check { display: flex; align-items: center; gap: 6px; font-size: 14px; flex: 0 0 calc(50% - 7px); }
.terr-check input { width: auto; }
@media (max-width: 760px) { .terr-grid { grid-template-columns: 1fr; } }
