/* =========================================================
   GLOBAL ONE CRM — STYLES
========================================================= */

:root {
  --navy: #0F1936;
  --navy-2: #162345;
  --gold: #C9974D;
  --gold-light: #D0AA67;
  --gold-dark: #B18443;
  --cream: #F8F6F1;
  --text: #1B2437;
  --muted: #687083;
  --border: #E5E2DA;
  --white: #FFFFFF;
  --red: #B3261E;
  --green: #2F6B3A;
  --wa: #1FA855;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--text);
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

a { color: var(--navy); }
h1, h2, h3 { margin: 0 0 12px; color: var(--navy); line-height: 1.2; }
h1 { font-family: "Playfair Display", Georgia, serif; font-weight: 500; font-size: 30px; }
h3 { font-size: 15px; font-weight: 700; margin-top: 4px; }
p { margin: 0 0 12px; }
code { padding: 1px 5px; background: #EFEBE2; border-radius: 3px; font-size: 12px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.muted-link { color: var(--muted); font-size: 13px; }
.inline { display: inline; margin: 0; }

/* ---------- Top bar ---------- */

.topbar { background: var(--navy); color: #fff; }

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
}

.brand em { font-style: normal; color: var(--gold-light); font-weight: 500; }

.brand-mark {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-light);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 15px;
}

.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.nav a {
  padding: 8px 12px;
  border-radius: 4px;
  color: rgba(255,255,255,.75);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.nav a:hover, .nav a.on { background: rgba(255,255,255,.08); color: #fff; }
.nav a.on { box-shadow: inset 0 -2px 0 var(--gold); }
.nav .nav-out { color: rgba(255,255,255,.5); }

.wrap {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 60px;
}

/* ---------- Messages ---------- */

.flash, .alert, .note {
  margin-bottom: 18px;
  padding: 13px 16px;
  border-radius: 4px;
  font-size: 13px;
}

.flash { background: #EEF5EF; border: 1px solid #CFE3D2; color: #23452B; }
.alert { background: #FBEDEC; border: 1px solid #F0C9C6; color: #7A1E18; }
.note  { background: #FFF8EC; border: 1px solid #F0DEBD; color: #6B4E1C; }

.alert-spam {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #D6D0C3;
  border-radius: 4px;
  background: #fff;
  color: var(--navy);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.btn:hover { border-color: var(--navy); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-light); }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn-wa:hover { background: #18914A; border-color: #18914A; }
.btn-small { min-height: 32px; padding: 0 11px; font-size: 12px; }
.btn-block { width: 100%; }
.btn.is-done { background: var(--green); border-color: var(--green); color: #fff; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

.link-btn.danger { color: var(--red); }

/* ---------- Page head ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-head p { margin: 0; }

.back {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

/* ---------- Panels & forms ---------- */

.panel {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.form-panel { max-width: 860px; }
.form-panel h3 { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-panel h3:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }

label {
  display: block;
  margin-bottom: 14px;
  color: #1A2340;
  font-size: 12px;
  font-weight: 600;
}

label small { color: var(--muted); font-weight: 400; }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="search"], input[type="url"], input[type="file"], select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #DDD8CD;
  border-radius: 4px;
  background: #fff;
  color: var(--navy);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
}

textarea { resize: vertical; line-height: 1.6; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,151,77,.14);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* ---------- Leads list ---------- */

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filters input[type="search"] { flex: 1 1 260px; margin: 0; }
.filters select { flex: 0 0 200px; width: auto; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid #DDD8CD;
  border-radius: 20px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.chip b { color: var(--muted); font-weight: 600; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.on b { color: var(--gold-light); }
.chip-spam { margin-left: auto; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: #B8B3A8; }

.lead-list {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.lead-row {
  display: grid;
  grid-template-columns: 2.2fr 1.2fr 1fr 1.2fr 1.1fr .9fr;
  gap: 12px;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.lead-row:last-child { border-bottom: 0; }
a.lead-row:hover { background: #FBFAF6; }

.lead-row-head {
  background: #FBFAF6;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.lead-row.is-new { box-shadow: inset 3px 0 0 var(--gold); }

.cell-name strong { display: block; color: var(--navy); }
.cell-name small { color: var(--muted); font-size: 12px; }
.cell-source, .cell-date { font-size: 12px; }

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 3px;
  background: #F1EDE4;
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 700;
}

.status {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  background: #EFEDE8;
  color: #4B5163;
  font-size: 11px;
  font-weight: 700;
}

/* Status colours */
.status.st-new { background: #FFF3DD; color: #8A5A10; }
.dot.st-new { background: var(--gold); }
.status.st-contacted { background: #E7EEFB; color: #24448A; }
.dot.st-contacted { background: #3D6AD6; }
.status.st-in-conversation { background: #EEE8FB; color: #4D3291; }
.dot.st-in-conversation { background: #7A55D4; }
.status.st-sent-to-partner, .status.st-linked-to-partner { background: #E4F3F3; color: #1F6467; }
.dot.st-sent-to-partner, .dot.st-linked-to-partner { background: #2F8F93; }
.status.st-won, .status.st-closed-won, .status.st-client { background: #E5F4E8; color: #23452B; }
.dot.st-won, .dot.st-closed-won, .dot.st-client { background: var(--green); }
.status.st-lost, .status.st-closed-lost, .status.st-not-a-fit { background: #F6E9E8; color: #7A1E18; }
.dot.st-lost, .dot.st-closed-lost, .dot.st-not-a-fit { background: var(--red); }

.empty {
  padding: 50px 20px;
  border: 1px dashed #D6D0C3;
  border-radius: 6px;
  background: #fff;
  text-align: center;
}

.footer-links { margin-top: 18px; color: var(--muted); font-size: 12px; }
.footer-links a { color: var(--muted); }

/* ---------- Lead page ---------- */

.lead-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 24px;
  align-items: start;
}

.card-tools { margin-bottom: 10px; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 500;
  cursor: pointer;
}

.switch input { width: 16px; height: 16px; margin: 0; accent-color: var(--navy); }

.partner-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15,25,54,.08);
}

.pc-head { padding: 24px 26px 22px; background: var(--navy); color: #fff; }

.pc-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  color: rgba(255,255,255,.8);
  font-size: 12px;
  font-weight: 700;
}

.pc-brand .brand-mark { width: 24px; height: 24px; font-size: 12px; }

.pc-kicker {
  margin-bottom: 6px;
  color: var(--gold-light);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.pc-name {
  margin: 0;
  color: #fff;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 500;
  font-size: 26px;
}

.pc-grid { margin: 0; padding: 8px 26px; }

.pc-row {
  display: grid;
  grid-template-columns: 42% 58%;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #EFECE5;
}

.pc-row:last-child { border-bottom: 0; }
.pc-row dt { color: var(--muted); font-size: 12px; }
.pc-row dd { margin: 0; color: var(--navy); font-size: 13px; font-weight: 600; word-break: break-word; }

.hide-contact .pc-contact { display: none; }

.pc-message { margin: 0 26px 6px; padding: 16px 18px; border-left: 2px solid var(--gold); background: var(--cream); }
.pc-message p { margin: 0; font-size: 13px; line-height: 1.65; white-space: normal; }

.pc-label {
  margin-bottom: 6px;
  color: var(--gold-dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.pc-foot {
  margin-top: 14px;
  padding: 12px 26px;
  border-top: 1px solid #EFECE5;
  color: #9A9FAB;
  font-size: 11px;
}

.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.contact-lines div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #F0EDE6;
}

.contact-lines div:last-child { border-bottom: 0; }
.contact-lines b { word-break: break-all; text-align: right; }

.note-form textarea { margin: 0 0 8px; }

.notes { margin: 16px 0 0; padding: 0; list-style: none; }
.notes li { padding: 12px 0; border-top: 1px solid #F0EDE6; }

.note-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.note-body { font-size: 13px; white-space: normal; word-break: break-word; }

.danger-zone { color: var(--muted); font-size: 12px; text-align: center; }

/* ---------- Settings ---------- */

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.settings-grid h3 { margin-top: 18px; }
.settings-grid h3:first-of-type { margin-top: 0; }

.copy-field {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 14px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #FBFAF6;
}

.copy-field code { flex: 1; background: none; padding: 0; word-break: break-all; }

.snippet {
  margin: 8px 0 12px;
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: 4px;
  background: var(--navy);
  color: #E8E4DA;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
}

/* ---------- Login ---------- */

.auth-body {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--navy);
}

.auth-card {
  width: min(420px, 100%);
  padding: 34px 30px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
}

.auth-brand { margin-bottom: 24px; color: var(--navy); }
.auth-brand em { color: var(--gold-dark); }
.auth-card h1 { font-size: 26px; }

/* ---------- Thank-you page ---------- */

.thanks-body {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--navy);
}

.thanks-card {
  width: min(560px, 100%);
  padding: 46px 36px;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.thanks-check {
  display: inline-flex;
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold-light);
  font-size: 24px;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.thanks-card h1 { font-size: 32px; }
.thanks-card h1 em { color: var(--gold-dark); }
.thanks-card p { margin: 0 auto 24px; max-width: 440px; color: var(--muted); line-height: 1.75; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .lead-layout, .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  h1 { font-size: 25px; }
  .topbar-inner { flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 0; }
  .nav a { padding: 7px 9px; }
  .grid-2 { grid-template-columns: 1fr; }
  .filters select { flex: 1 1 100%; }
  .chip-spam { margin-left: 0; }

  .lead-row-head { display: none; }
  .lead-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "name status" "cat date";
    gap: 6px 12px;
  }
  .cell-name { grid-area: name; }
  .cell-status { grid-area: status; text-align: right; }
  .cell-cat { grid-area: cat; }
  .cell-date { grid-area: date; text-align: right; }
  .cell-partner, .cell-source { display: none; }

  .pc-head, .pc-grid, .pc-foot { padding-left: 18px; padding-right: 18px; }
  .pc-message { margin-left: 18px; margin-right: 18px; }
  .pc-row { grid-template-columns: 1fr; gap: 2px; }
  .panel { padding: 18px; }
}
