/* Pipeline tracker styles.
   Brand colours live in the variables below. Replace the accent values
   with the doubleslash colours to match the house style. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1d2126;
  --ink-soft: #5b6472;
  --line: #e3e6ea;
  --accent: #2f5fe0;          /* primary action / brand */
  --accent-ink: #ffffff;
  --overdue: #c0352b;
  --overdue-bg: #fdeceb;
  --today-bg: #fff6e6;
  --ok: #1f7a4d;
  --warn: #9a6a00;
  --warn-bg: #fdf3da;
  --radius: 8px;
  --gap: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; align-items: center; gap: 18px; }
.account { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--ink-soft); }
.inline { display: inline; }
.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

/* Content */
.content { max-width: 1120px; margin: 0 auto; padding: 24px 20px 64px; }
.pagehead { display: flex; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.pagehead h1 { font-size: 24px; margin: 0; }
.headactions { margin-left: auto; display: flex; gap: 8px; }
.sub { color: var(--ink-soft); margin: 0; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
.btn:hover { text-decoration: none; border-color: var(--ink-soft); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-danger { color: var(--overdue); border-color: var(--overdue); }

/* Messages */
.messages { list-style: none; margin: 0; padding: 12px 20px 0; max-width: 1120px; margin: 0 auto; }
.msg { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 8px; }
.msg-success { background: #e8f5ee; color: var(--ok); }
.msg-warning { background: var(--warn-bg); color: var(--warn); }
.msg-error { background: var(--overdue-bg); color: var(--overdue); }

/* View tabs */
.viewtabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.viewtabs a { padding: 8px 14px; color: var(--ink-soft); border-bottom: 2px solid transparent; }
.viewtabs a:hover { text-decoration: none; color: var(--ink); }
.viewtabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters input, .filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; background: var(--surface); }
.filters input[type=search] { min-width: 240px; }

/* Table */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.leads { width: 100%; border-collapse: collapse; font-size: 14px; }
table.leads th, table.leads td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.leads th { color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
table.leads tbody tr:hover { background: #f0f3fb; cursor: pointer; }
table.leads td.num, table.leads th.num { text-align: right; white-space: nowrap; }
td.action { max-width: 280px; }
.row-overdue { background: var(--overdue-bg); }
.row-overdue:hover { background: #fbe0de; }
.row-today { background: var(--today-bg); }
.due-overdue { color: var(--overdue); font-weight: 600; }
.overdue-note { color: var(--overdue); font-weight: 600; margin: 0; }

/* Status chips */
.status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef0f3; color: var(--ink-soft); white-space: nowrap; }
.status-identified { background: #eef0f3; color: #555; }
.status-contacted { background: #e6eefc; color: #27499f; }
.status-followed_up { background: #e6eefc; color: #27499f; }
.status-replied { background: #e4f3ea; color: #1f7a4d; }
.status-call_booked { background: #e4f3ea; color: #1f7a4d; }
.status-quote_sent { background: #fdf3da; color: #9a6a00; }
.status-won { background: #1f7a4d; color: #fff; }
.status-lost { background: #efe1e0; color: #a23228; }
.status-not_now { background: #efeef3; color: #6a5a8a; }

/* Badges */
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
.badge-warn { background: var(--warn-bg); color: var(--warn); }

/* Forms */
.leadform { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-width: 820px; }
.leadform fieldset { border: 0; border-top: 1px solid var(--line); margin: 0 0 20px; padding: 16px 0 0; }
.leadform legend { font-weight: 700; padding: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; margin-bottom: 12px; }
.field label { font-weight: 600; margin-bottom: 4px; font-size: 14px; }
.field input, .field select, .field textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; background: var(--surface); width: 100%; }
.field .help { color: var(--ink-soft); font-size: 12px; margin-top: 4px; }
.field .error { color: var(--overdue); font-size: 13px; margin-top: 4px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--overdue); }
.hint { color: var(--ink-soft); font-size: 13px; }
.formactions { display: flex; gap: 8px; margin-top: 10px; }
.formerrors { background: var(--overdue-bg); color: var(--overdue); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; }

/* Detail */
dl.detail { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
dl.detail dt { color: var(--ink-soft); font-weight: 600; }
dl.detail dd { margin: 0; }
.banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; }
.banner-overdue { background: var(--overdue-bg); color: var(--overdue); }
.meta { color: var(--ink-soft); font-size: 13px; }

/* Summary */
.review { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.review h2 { margin-top: 0; font-size: 18px; }
.cards { display: flex; gap: 14px; flex-wrap: wrap; }
.card { flex: 1 1 180px; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card-ok { border-color: var(--ok); background: #f1f9f4; }
.card-num { font-size: 28px; font-weight: 700; }
.card-label { color: var(--ink-soft); }
.stages { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.stages li { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
.bignum { font-size: 32px; font-weight: 700; margin: 4px 0; }
.good { color: var(--ok); }

/* Login */
.loginbox { max-width: 360px; margin: 48px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.loginbox h1 { margin: 0 0 4px; }

.empty { color: var(--ink-soft); }

@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  dl.detail { grid-template-columns: 1fr; }
  dl.detail dt { margin-top: 8px; }
  .account .who { display: none; }
}
