:root {
  --deep-green: #1F3A2E;
  --white-smoke: #F4F4F2;
  --burnt-orange: #D97B5A;
  --green-1: #1F412E;
  --green-2: #2C5F43;
  --green-3: #377955;
  --green-4: #408E64;
  --green-5: #50B17D;
  --link-blue: #1155CC;
  --grey: #757570;
  --grey-light: #E4E3DF;
  --card-shadow: 0 1px 2px rgba(31, 58, 46, 0.08), 0 1px 8px rgba(31, 58, 46, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--white-smoke);
  color: var(--deep-green);
  font-family: "Instrument Sans", system-ui, sans-serif;
}

h1, h2, h3 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  margin: 0;
}

a { color: var(--link-blue); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 40px 20px;
}

.topbar h1 { font-size: 32px; }

.topbar-actions { display: flex; align-items: center; gap: 20px; }

.global-search { position: relative; }
.global-search input[type="text"] { width: 220px; font-size: 13.5px; padding: 8px 10px; }
.global-search .combobox-results { position: absolute; top: 100%; left: 0; width: 280px; z-index: 20; }
.global-search .combobox-item { display: block; text-decoration: none; color: var(--deep-green); }
.global-search .combobox-item .combobox-stage { display: block; }

.topbar-select { width: auto; padding: 8px 10px; font-size: 13.5px; }

.reminders-owner-filter { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; }
.reminders-owner-filter span { font-size: 13px; color: var(--grey); }

.duplicate-warning {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--burnt-orange);
  border-radius: 8px;
  background: rgba(217, 123, 90, 0.08);
}
.duplicate-warning p { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--deep-green); }
.duplicate-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 13.5px; }

.toggle { font-size: 14px; color: var(--grey); display: flex; align-items: center; gap: 6px; cursor: pointer; }

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
}

.btn-primary { background: var(--burnt-orange); color: white; }
.btn-primary:hover { opacity: 0.92; }

.btn-secondary { background: var(--grey-light); color: var(--deep-green); }
.btn-secondary:hover { opacity: 0.85; }

.btn-text {
  background: none;
  color: var(--grey);
  padding: 6px 8px;
  font-weight: 500;
}
.btn-text:hover { color: var(--deep-green); }

/* ---------- board ---------- */

.board {
  display: flex;
  gap: 16px;
  padding: 0 40px 40px;
  align-items: flex-start;
  overflow-x: auto;
}

.column {
  flex: 1 0 220px;
  max-width: 280px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 130px);
}

.column.side { background: rgba(117, 117, 112, 0.08); }

.column-header {
  padding: 12px 14px;
  border-radius: 12px 12px 0 0;
  color: white;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.column.side .column-header { background: var(--grey); }

.column-add {
  background: rgba(255, 255, 255, 0.25);
  border: none;
  color: white;
  border-radius: 6px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.column-add:hover { background: rgba(255, 255, 255, 0.4); }

.card-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-list.drag-over { background: rgba(80, 177, 125, 0.15); border-radius: 0 0 12px 12px; }

.card {
  background: white;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 12px;
  cursor: grab;
}
.card:active { cursor: grabbing; }

.card-company {
  font-family: "Instrument Serif", serif;
  font-size: 18px;
  margin: 0 0 6px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--grey);
  margin-top: 3px;
}

.card-value { color: var(--deep-green); font-weight: 600; }

.card-date.stale { color: var(--burnt-orange); }

/* ---------- overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 58, 46, 0.35);
  display: flex;
  justify-content: flex-end;
  z-index: 50;
}
.overlay.hidden { display: none; }
.overlay.centered { justify-content: center; align-items: center; }

.panel {
  background: var(--white-smoke);
  width: min(480px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 28px 30px 60px;
}

.modal {
  background: var(--white-smoke);
  width: min(480px, 92vw);
  border-radius: 14px;
  padding: 26px 28px;
  max-height: 88vh;
  overflow-y: auto;
}

.panel-close, .modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--grey);
  cursor: pointer;
  float: right;
}

/* ---------- forms ---------- */

label { display: block; font-size: 12.5px; color: var(--grey); margin: 14px 0 4px; }
label.inline { display: inline; margin: 0 0 0 6px; }

input[type="text"], input[type="email"], input[type="number"], input[type="date"],
select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--grey-light);
  border-radius: 6px;
  background: white;
  color: var(--deep-green);
}
textarea { resize: vertical; min-height: 60px; }

.field-row { display: flex; gap: 10px; }
.field-row > div { flex: 1; }

.form-actions { margin-top: 18px; display: flex; gap: 10px; }

/* ---------- detail sections ---------- */

.section { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--grey-light); }
.section h3 { font-size: 20px; margin-bottom: 10px; }

.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--green-4);
  color: white;
  margin-left: 8px;
}

.contact-item, .interaction-item {
  background: white;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 13.5px;
}

.contact-name { font-weight: 600; }
.contact-role { color: var(--grey); font-size: 12px; }

.interaction-date { font-weight: 600; font-size: 12px; color: var(--green-1); }
.interaction-type {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--grey);
  margin-left: 6px;
}
.interaction-note { margin-top: 3px; }
.interaction-nodate { color: var(--burnt-orange); font-style: italic; }

.mini-form { margin-top: 10px; }

.reminder-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--grey-light);
}
.reminder-block .field-row { margin-top: 8px; }
.reminder-block input[type="number"] { width: 60px; }
.reminder-current { font-size: 13.5px; color: var(--deep-green); margin: 4px 0 0; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--deep-green);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13.5px;
  z-index: 100;
}
.toast.hidden { display: none; }
.toast.error { background: #a13b2a; }

.empty-note { color: var(--grey); font-size: 13px; font-style: italic; }

/* ---------- analytics ---------- */

.analytics-main { padding: 0 40px 60px; max-width: 900px; }

.stat-row { display: flex; gap: 16px; margin-bottom: 8px; }

.stat-tile {
  background: white;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 16px 20px;
  flex: 1;
}

.stat-value {
  font-family: "Instrument Sans", sans-serif;
  font-size: 32px;
  font-weight: 600;
  color: var(--deep-green);
}

.stat-label { font-size: 13px; color: var(--grey); margin-top: 2px; }
.stat-sub { font-size: 11.5px; color: var(--grey); margin-top: 1px; }

.chart-section { margin-top: 36px; }
.chart-section h2 { font-size: 24px; margin-bottom: 8px; }

.chart-caption { font-size: 13.5px; color: var(--grey); max-width: 640px; margin: 0 0 18px; line-height: 1.5; }

.bar-chart { display: flex; flex-direction: column; }

.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }

.bar-label {
  width: 170px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--deep-green);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  flex: 1;
  background: var(--grey-light);
  border-radius: 4px;
  height: 20px;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  min-width: 3px;
}

.bar-value {
  width: 42px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--deep-green);
  font-variant-numeric: tabular-nums;
}

.table-toggle { margin-top: 10px; }
.table-toggle summary { font-size: 12.5px; color: var(--link-blue); cursor: pointer; }

.data-table { border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 5px 16px 5px 0; border-bottom: 1px solid var(--grey-light); }
.data-table th { color: var(--grey); font-weight: 600; }

.side-stat-row { display: flex; gap: 24px; margin-top: 14px; }
.side-stat { display: flex; align-items: baseline; gap: 6px; }
.side-stat-value { font-size: 20px; font-weight: 600; color: var(--grey); }
.side-stat-label { font-size: 13px; color: var(--grey); }

/* ---------- reminders ---------- */

.reminders-main { padding: 0 40px 60px; max-width: 1100px; }

.reminders-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 16px;
}

.threshold-toggle { display: flex; gap: 8px; }

.reminder-count { font-size: 13.5px; color: var(--grey); }

.reminder-list { display: flex; flex-direction: column; gap: 10px; }

.reminder-row {
  background: white;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.reminder-main { display: flex; align-items: center; gap: 10px; flex: 0 0 230px; min-width: 0; }

.reminder-company {
  font-family: "Instrument Serif", serif;
  font-size: 18px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reminder-company:hover { text-decoration: underline; }

.stage-tag {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--grey);
  border: 1px solid var(--grey-light);
  border-radius: 999px;
  padding: 2px 8px;
}

.reminder-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--grey);
  flex: 1 1 210px;
  min-width: 0;
  flex-wrap: wrap;
}

.badge-nodate {
  background: var(--burnt-orange);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}

.days-overdue { color: var(--deep-green); font-weight: 600; }

.reminder-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }

.snooze-group { display: flex; align-items: center; gap: 4px; }
.snooze-label { font-size: 11.5px; color: var(--grey); margin-right: 2px; }

/* ---------- tabs ---------- */

.tab-row { display: flex; gap: 4px; margin: 4px 0 22px; border-bottom: 1px solid var(--grey-light); }

.tab-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--grey);
  padding: 10px 4px;
  margin-right: 22px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--deep-green); border-bottom-color: var(--burnt-orange); }

.tab-panel.hidden { display: none; }

/* ---------- reminder row extras ---------- */

.badge-reminder {
  background: var(--green-4);
  color: white;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}

.stage-tag-client { border-color: var(--green-3); color: var(--green-1); }

.badge-checkin {
  color: var(--deep-green);
  font-weight: 600;
  font-size: 12.5px;
}

.custom-form {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--grey);
  width: 100%;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--grey-light);
}
.custom-form.hidden { display: none; }
.custom-form input[type="number"] { width: 56px; padding: 5px 6px; }
.custom-form select { width: auto; padding: 5px 6px; }
.custom-form input[type="date"] { width: auto; padding: 5px 6px; }
.custom-or { margin-left: 6px; }

.hidden { display: none; }

/* ---------- schedule check-in modal ---------- */

.combobox-results {
  position: relative;
  margin-top: 4px;
  border: 1px solid var(--grey-light);
  border-radius: 6px;
  background: white;
  max-height: 180px;
  overflow-y: auto;
}

.combobox-item { padding: 8px 12px; font-size: 13.5px; cursor: pointer; }
.combobox-item:hover { background: var(--grey-light); }
.combobox-empty { padding: 8px 12px; font-size: 13px; color: var(--grey); font-style: italic; }

.radio-row { display: flex; gap: 20px; margin: 6px 0 12px; }
.inline-radio { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--deep-green); }
.inline-radio input { width: auto; }

#when-relative input[type="number"] { width: 70px; }

/* ---------- empty state ---------- */

.empty-state {
  background: white;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 32px 28px;
  text-align: center;
}
.empty-state p { color: var(--grey); font-size: 14px; max-width: 480px; margin: 0 auto 18px; line-height: 1.5; }

.badge-note {
  color: var(--grey);
  font-size: 12px;
  font-style: italic;
}

/* ---------- incoming leads ---------- */

.lead-row {
  background: white;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 16px;
  margin-bottom: 10px;
}

.lead-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

.lead-main { flex: 0 0 240px; min-width: 0; }
.lead-name { font-family: "Instrument Serif", serif; font-size: 18px; }
.lead-role { font-size: 13px; color: var(--grey); }
.lead-company { font-size: 13.5px; color: var(--deep-green); font-weight: 600; margin-top: 2px; }

.lead-detail { flex: 1 1 260px; font-size: 13px; color: var(--grey); }
.lead-report { margin-top: 3px; }

.lead-approve-form {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--grey-light);
}
.lead-approve-form.hidden { display: none; }
.lead-match-status { margin: 8px 0; }

.combobox-stage { color: var(--grey); font-size: 11.5px; }

/* ---------- inbox suggestions ---------- */

.suggestion-row {
  background: white;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.suggestion-main { flex: 1 1 400px; min-width: 0; }

.suggestion-kind {
  display: inline-block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: white;
  background: var(--green-3);
  padding: 2px 9px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.suggestion-owner {
  display: inline-block;
  font-size: 11.5px;
  color: var(--grey);
  font-style: italic;
  margin-left: 8px;
}

.suggestion-summary { font-size: 15px; color: var(--deep-green); margin: 0 0 4px; }
.suggestion-detail { font-size: 13px; color: var(--grey); margin: 0 0 4px; }
.suggestion-company { font-size: 12.5px; }

/* ---------- login ---------- */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: white;
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.login-card h1 { font-size: 26px; text-align: center; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--grey); font-size: 13.5px; margin: 0 0 26px; }

.login-form.hidden { display: none; }
.login-submit { width: 100%; }
.login-submit:disabled { opacity: 0.6; cursor: default; }

.login-message { font-size: 13px; color: var(--grey); margin: 10px 0 0; text-align: center; min-height: 16px; }
.login-message.error { color: #a13b2a; }

#btn-use-different-email { display: block; margin: 6px auto 0; }

#code { text-align: center; font-size: 22px; letter-spacing: 6px; }

/* ---------- users admin screen ---------- */

.add-user-form {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.add-user-form input[type="email"] { flex: 1 1 220px; }
.add-user-form input[type="text"] { flex: 1 1 220px; }

.user-owner-aliases { margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.alias-edit-form { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.alias-edit-form input[type="text"] { width: auto; flex: 1 1 260px; }

.inline-checkbox { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--deep-green); white-space: nowrap; }
.inline-checkbox input { width: auto; }

.user-row {
  background: white;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.user-email { font-family: "Instrument Serif", serif; font-size: 17px; }

.admin-badge {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: white;
  background: var(--green-3);
  padding: 2px 9px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}

.assign-mode-toggle {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--grey-light);
  display: flex;
  gap: 4px;
}
.assign-mode-toggle button {
  border-radius: 6px;
  color: var(--grey);
}
.assign-mode-toggle button.active {
  background: var(--grey-light);
  color: var(--deep-green);
}

.assign-existing-panel, .assign-new-panel {
  margin-top: 10px;
  max-width: 420px;
}
.assign-existing-panel.hidden, .assign-new-panel.hidden { display: none; }
.assign-selected { margin: 8px 0 0; }
