:root {
  --prussian: #0C4658;
  --teal: #0CB8B6;
  --frost: #E0F9FB;
  --white: #FFFFFF;
  --line: rgba(12, 70, 88, .08);
  --muted: rgba(12, 70, 88, .72);
  --shadow: 0 10px 24px rgba(12, 70, 88, .12);
  --r-card: 12px;
  --r-panel: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--white);
  color: var(--prussian);
  font: 400 15px/1.5 Lato, system-ui, sans-serif;
}
h1, h2, h3 { font-family: Montserrat, system-ui, sans-serif; font-weight: 700; margin: 0; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; font-weight: 600; }
a { color: var(--prussian); }
:focus-visible { outline: 3px solid var(--prussian); outline-offset: 2px; }

.topbar {
  display: flex; align-items: center; gap: 32px; flex-wrap: wrap;
  padding: 16px 24px; background: var(--prussian); color: var(--frost);
  border-bottom: 3px solid var(--teal);
}
.topbar :focus-visible { outline-color: var(--frost); }
.brand { font: 700 18px Montserrat, system-ui, sans-serif; }
.brand span { color: var(--teal); }
.topbar nav { display: flex; gap: 8px; }
.topbar nav a {
  color: var(--frost); text-decoration: none; padding: 8px 16px; border-radius: var(--r-card);
}
.topbar nav a[aria-current="page"] { background: rgba(224, 249, 251, .14); font-weight: 700; }

main { padding: 24px; max-width: 1840px; margin: 0 auto; }
.login { max-width: 360px; margin-top: 48px; }
.login form { display: grid; gap: 8px; margin-top: 24px; }
.login label { font-size: 13px; font-weight: 700; margin-top: 8px; }
.login .btn { justify-self: start; }
main:focus { outline: none; }

.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .spacer { flex: 1; }
.back { font-size: 14px; display: inline-block; margin-bottom: 8px; }

.btn {
  font: 700 14px Lato, system-ui, sans-serif; border-radius: var(--r-card);
  padding: 8px 16px; cursor: pointer; border: 1px solid var(--prussian);
}
.btn-primary { background: var(--prussian); color: var(--white); }
.btn-quiet { background: var(--white); color: var(--prussian); }
.btn-small { padding: 4px 8px; font-size: 13px; }

input, select, textarea {
  font: inherit; color: var(--prussian); width: 100%;
  padding: 8px; border: 1px solid rgba(12, 70, 88, .4); border-radius: var(--r-card); background: var(--white);
}
textarea { min-height: 88px; resize: vertical; }
.search { max-width: 320px; }

/* Summary tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.tile { background: var(--frost); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 24px; }
.tile .num { font: 700 24px Montserrat, system-ui, sans-serif; }
.tile .label { font-size: 13px; color: var(--muted); }

/* Pipeline board */
.board { display: grid; grid-template-columns: repeat(8, minmax(200px, 1fr)); gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.column { background: var(--frost); border-radius: var(--r-panel); padding: 16px; min-height: 240px; }
.column.drop-target { box-shadow: inset 0 0 0 3px var(--prussian); }
.column-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.column-head .count { font-size: 13px; color: var(--muted); }
.column-head .sum { display: block; font-size: 13px; color: var(--muted); }

.card {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 16px; margin-bottom: 8px; cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--teal); }
.card .title { font-weight: 700; }
.card .meta { font-size: 13px; color: var(--muted); }
.card .next { font-size: 13px; margin-top: 8px; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-card); margin-top: 8px; }
.badge-stale { background: var(--frost); border: 1px solid var(--prussian); }
.badge-overdue { background: var(--prussian); color: var(--frost); }

/* Tables and lists */
.panel { border: 1px solid var(--frost); border-radius: var(--r-panel); padding: 24px; margin-bottom: 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--frost); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 700; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--frost); }
.table-wrap { overflow-x: auto; }
.empty { color: var(--muted); }
.ghl-status { font-size: 13px; font-weight: 700; margin: 8px 0 0; }
.ghl-status:empty { display: none; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 24px; }
.detail-grid dt { font-size: 13px; color: var(--muted); }
.detail-grid dd { margin: 0 0 8px; }

.task { display: flex; gap: 16px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--frost); }
.task input[type="checkbox"] { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.task .when { font-size: 13px; color: var(--muted); }
.task.is-done .summary { text-decoration: line-through; color: var(--muted); }
/* Call briefs from the lead pipeline are multi-line: keep their line breaks. */
.task .summary { white-space: pre-wrap; }

/* Form dialog */
dialog { border: none; border-radius: var(--r-panel); padding: 24px; width: min(640px, calc(100vw - 32px)); color: var(--prussian); }
dialog::backdrop { background: rgba(12, 70, 88, .45); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0 8px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.form-error { color: var(--prussian); font-weight: 700; min-height: 1.5em; }
.form-actions { display: flex; gap: 8px; }
.form-actions .spacer { flex: 1; }

/* Call tasks */
.note { font-size: 13px; color: var(--muted); }
.call-card .call-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.call-card .call-head .spacer { flex: 1; }
.call-card .meta { font-size: 13px; color: var(--muted); }
.call-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 24px; }
.call-cols ul { margin: 8px 0 16px; padding-left: 20px; }
.script { background: var(--frost); border-radius: var(--r-card); padding: 16px; margin: 8px 0 16px; }
.script summary { font-weight: 700; cursor: pointer; }
.script dt { font-size: 13px; font-weight: 700; margin-top: 16px; }
.script dd { margin: 4px 0 0; }
.call-outcome { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.call-outcome label { font-size: 13px; font-weight: 700; }
.call-outcome input { flex: 1; min-width: 200px; }
.segmented { display: flex; gap: 4px; }
.segmented a, .page-link {
  padding: 4px 16px; border: 1px solid var(--prussian); border-radius: var(--r-card); text-decoration: none; font-size: 14px;
}
.segmented a[aria-current="page"], .page-link[aria-current="page"] { background: var(--prussian); color: var(--white); }
.pager { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 8px 0 24px; }

@media (max-width: 640px) {
  main { padding: 16px; }
  .topbar { gap: 8px; padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:hover { transform: none; }
}
