/* Eagleox CRM — Eagleox brand: navy #003C52, slate #4C6371 / #6C8393, cool grey #BABFC4 */
:root {
  --navy: #003C52; --slate: #4C6371; --slate-l: #6C8393; --grey: #BABFC4;
  --bg: #F4F6F8; --line: #E1E5E9; --text: #13232C; --muted: #6C8393;
  --red: #C0392B; --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Helvetica Neue", Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--navy); }
h1 { font-size: 24px; margin: 0 0 6px; color: var(--navy); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
h2 { font-size: 16px; margin: 0 0 12px; color: var(--navy); }
h3 { font-size: 14px; color: var(--slate); margin: 16px 0 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.top { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px; }
.top a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 17px; }
.top .tabs { display: flex; gap: 18px; flex: 1; }
.top .tabs a { opacity: .8; display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 2px solid transparent; }
.top .tabs a:hover, .top .tabs a.on { opacity: 1; }
.top .tabs a.on { border-bottom-color: #fff; }
.top .tabs svg { display: none; width: 22px; height: 22px; fill: currentColor; }
.top .tabs .tab-only { display: none; }
.who { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.who form { margin: 0; }
.link { background: none; border: 0; color: var(--grey); cursor: pointer; font: inherit; padding: 0; }

main { max-width: 1180px; margin: 0 auto; padding: 24px; }
body.bare main { padding-top: 10vh; }

.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.crumb { margin: 0 0 4px; font-size: 13px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.card.wide-ish { max-width: 680px; }
.grid { display: grid; grid-template-columns: 1fr 2fr; gap: 18px; align-items: start; }
.grid .card { margin-bottom: 0; }
.grid .wide { grid-column: span 1; }
.grid > .card.wide:first-child { order: 0; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--text); }
.stat b { display: block; font-size: 28px; color: var(--navy); }
.stat span { color: var(--muted); font-size: 13px; }
.stat.hot b { color: var(--red); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate); border-bottom: 2px solid var(--line); padding: 8px 10px; }
td { border-bottom: 1px solid var(--line); padding: 10px; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.done td { opacity: .55; }
.card { overflow-x: auto; }

dl { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0 0 12px; }
dt { color: var(--muted); font-size: 13px; } dd { margin: 0; }
.meta { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin-bottom: 0; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #EEF1F3; color: var(--slate); white-space: nowrap; }
.b-active, .b-resolved { background: #E3F4E8; color: #1E7B3C; }
.b-lead, .b-in-progress { background: #E3EEF8; color: #1D5A8C; }
.b-paused, .b-waiting-on-client { background: #FFF4D6; color: #8A6400; }
.b-former, .b-low { background: #EEF1F3; color: var(--slate-l); }
.b-medium { background: #E3EEF8; color: #1D5A8C; }
.b-high { background: #FDEBD8; color: #A04F00; }
.b-urgent, .b-open { background: #FBE3E1; color: var(--red); }

.form label { display: block; font-size: 13px; color: var(--slate); margin-bottom: 12px; font-weight: 600; }
.form label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); padding: 9px 11px; border: 1px solid var(--grey); border-radius: 6px; background: #fff; margin-top: 4px; font-weight: 400; }
input[type=checkbox] { width: auto; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--slate-l); outline-offset: 0; border-color: var(--slate-l); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row.three { grid-template-columns: 1fr 1fr 1fr; }
.row.tight { grid-template-columns: 220px auto; align-items: end; justify-content: start; }
.row.tight .btn { margin-bottom: 12px; }
@media (max-width: 600px) { .row, .row.three { grid-template-columns: 1fr; } }

.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; margin: 0; }
.filters input[type=search] { flex: 1; min-width: 200px; }

.btn { display: inline-block; background: var(--navy); color: #fff; border: 1px solid var(--navy); border-radius: 6px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--slate); border-color: var(--slate); }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--grey); }
.btn.ghost:hover { border-color: var(--navy); }
.btn.danger { background: #fff; color: var(--red); border-color: #E8B4AE; }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.danger-zone { margin-top: 8px; text-align: right; }

.flash { padding: 11px 14px; border-radius: 6px; margin-bottom: 16px; background: #E3F4E8; color: #1E5A30; }
.flash.warn { background: #FBE3E1; color: #8A2219; }
.flash ul { margin: 0; padding-left: 18px; }

.timeline { list-style: none; padding: 0; margin: 0 0 18px; }
.timeline li { border-left: 3px solid var(--grey); padding: 4px 0 10px 14px; margin-left: 4px; }
.timeline li.system { border-left-color: var(--line); font-size: 13px; color: var(--muted); }
.timeline .who { font-size: 13px; }
.grid.flip { grid-template-columns: 2fr 1fr; }
@media (max-width: 860px) { .grid.flip { grid-template-columns: 1fr; } }
.btn { white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 30px; width: auto; display: block; }

/* Error pages (403 / 404 / 400) */
.error-card { max-width: 520px; margin: 6vh auto 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.error-band { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 10px; padding: 14px 24px; font-weight: 700; font-size: 17px; }
.error-band img { height: 30px; width: auto; display: block; }
.error-body { padding: 28px 28px 30px; }
.error-code { font-size: 64px; font-weight: 700; line-height: 1; margin: 0 0 10px; color: var(--grey); letter-spacing: -.02em; }
.error-body h1 { margin-bottom: 8px; }
.error-body .actions { margin-top: 22px; }
body.app .error-card { margin-top: 3vh; }

/* Logo always small, even before the stylesheet finishes loading */
.brand img { height: 30px; width: auto; max-width: 40px; }
.top { padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
.bare-top { justify-content: center; }
body.bare main { padding-top: 6vh; }

/* ---------- Phones ---------- */
@media (max-width: 700px) {
  body { font-size: 16px; }
  main { padding: 16px 14px calc(84px + env(safe-area-inset-bottom)); }
  body.bare main { padding-bottom: 24px; }
  .top { padding-left: 16px; padding-right: 16px; gap: 12px; height: calc(52px + env(safe-area-inset-top)); }
  .who .me-link { display: none; }

  /* Main menu becomes a bottom tab bar */
  .top .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; gap: 0; justify-content: space-around;
    background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .top .tabs a, .top .tabs .tab-only { display: flex; flex-direction: column; gap: 2px; flex: 1; align-items: center;
    color: var(--slate-l); opacity: 1; font-size: 11px; border: 0; padding: 4px 0; }
  .top .tabs a.on { color: var(--navy); font-weight: 600; }
  .top .tabs svg { display: block; }

  h1 { font-size: 21px; }
  .head { align-items: flex-start; margin-bottom: 14px; }
  .head .actions { width: 100%; }
  .head .actions .btn { flex: 1; text-align: center; }
  .card { padding: 16px; }
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 24px; }
  .filters input, .filters select, .filters .btn { width: 100%; flex: 1 1 100%; }
  input, select, textarea { font-size: 16px; } /* stops iPhones zooming in on fields */
  .row.tight { grid-template-columns: 1fr; }
  .row.tight .btn { width: 100%; }
  .btn { padding: 11px 16px; }
  dl { grid-template-columns: 110px 1fr; }
  .error-card { margin-top: 2vh; }
  .error-code { font-size: 52px; }

  /* Tables turn into stacked cards */
  .card { overflow-x: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
  tr:last-child { margin-bottom: 0; }
  td { border: 0; padding: 3px 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex-shrink: 0; }
  td:first-child { font-weight: 600; font-size: 16px; text-align: left; padding-bottom: 6px; }
  td:first-child::before, td[data-label=""]::before { content: none; }
  td[data-label=""] { justify-content: flex-start; }
  tr.done td { opacity: .6; }
}

/* Installed app (standalone) */
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
}
.who { margin-left: auto; }

/* ---------- Contacts & pipeline ---------- */
.b-new-lead { background: #EEF1F3; color: var(--slate); }
.b-contacted { background: #E3EEF8; color: #1D5A8C; }
.b-meeting-booked { background: #DFF3F1; color: #11695F; }
.b-qualified { background: #ECE6F8; color: #5B3C9C; }
.b-proposal-sent { background: #FDEBD8; color: #A04F00; }
.b-negotiation { background: #FFF4D6; color: #8A6400; }
.b-won { background: #E3F4E8; color: #1E7B3C; }
.b-lost { background: #F3E4E2; color: #8A3A31; }

.sub { margin: 0; }
h2.spaced { margin-top: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.funnel { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.funnel-step { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--text); }
.funnel-step b { font-size: 22px; color: var(--navy); }
.funnel-step:hover { border-color: var(--slate-l); }
@media (max-width: 980px) { .funnel { grid-template-columns: repeat(4, 1fr); } }

.stage-bar { list-style: none; display: flex; margin: 0; padding: 0; gap: 4px; }
.stage-bar li { flex: 1; position: relative; padding-top: 12px; font-size: 12px; color: var(--muted); text-align: center; }
.stage-bar li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; border-radius: 3px; background: var(--line); }
.stage-bar li.done::before { background: var(--slate-l); }
.stage-bar li.now::before { background: var(--navy); }
.stage-bar li.now { color: var(--navy); font-weight: 700; }
.stage-bar li.lost::before { background: #E8C3BE; }
.stage-bar li.lost.now::before { background: var(--red); }
.stage-bar li.lost.now { color: var(--red); }

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; }
.lane { background: #E9EDF0; border-radius: 8px; padding: 10px; min-height: 160px; scroll-snap-align: start; }
.lane header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.lane .empty { text-align: center; margin: 24px 0; }
.deal { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin-bottom: 8px; }
.deal-name { font-weight: 600; text-decoration: none; }
.deal-meta { display: flex; justify-content: space-between; gap: 8px; margin: 6px 0 8px; }
.stale { color: var(--red); font-weight: 600; }
.deal .move select { margin: 0; padding: 5px 8px; font-size: 13px; color: var(--slate); }
.filters.inline { margin: 0; flex-wrap: nowrap; }

.contact-picker { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px 2px; margin: 0 0 12px; }
.contact-picker legend { font-size: 13px; font-weight: 600; color: var(--slate); padding: 0 4px; }
.contact-picker .check { margin-bottom: 8px; }
.contact-picker p { margin: 0 0 8px; }
.people { list-style: none; padding: 0; margin: 0 0 12px; }
.people li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }

@media (max-width: 700px) {
  .who .me-link { display: inline; font-size: 14px; }
  .funnel { grid-template-columns: repeat(2, 1fr); }
  .board { grid-auto-columns: 82%; }
  .filters.inline { width: 100%; }
  .stage-bar li span { display: none; }
  .stage-bar li.now span { display: inline; white-space: nowrap; }
  .stage-bar li.now { flex: 3; }
  .lane .deal td { display: block; }
}
[hidden] { display: none !important; }
.resend { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }
.resend p { margin: 0 0 8px; }
.flash { overflow-wrap: anywhere; }
.facts { padding-left: 18px; margin: 14px 0 18px; } .facts li { margin-bottom: 6px; }
.btn.danger.small, a.btn.danger { display: inline-block; }
.forgot { margin: 14px 0 0; font-size: 14px; }
