:root {
  --blue: #1769ff;
  --blue-dark: #0b4fc9;
  --navy: #07152f;
  --navy-2: #0b2146;
  --bg: #f5f8fc;
  --line: #e4eaf2;
  --muted: #64748b;
  --text: #122039;
  --white: #fff;
}

/* Apex Leads Inc. command center styling */
:root {
  --blue: #356fff;
  --blue-dark: #163f9f;
  --navy: #050e21;
  --navy-2: #102656;
  --bg: #f3f6fb;
  --line: #d9e3f1;
  --muted: #64748b;
  --text: #0b1832;
  --cyan: #4fd8ff;
  --violet: #6c5df5;
}
body {
  font-family:
    "Avenir Next",
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 90% 0, #eaf0ff 0, transparent 28%), var(--bg);
}
.crm-sidebar {
  background: radial-gradient(
    circle at 30% 0,
    #142f67 0,
    #08152e 40%,
    #050e21 100%
  );
  border-right: 1px solid rgba(118, 159, 231, 0.16);
}
.crm-logo span {
  background: linear-gradient(
    145deg,
    var(--cyan),
    var(--blue) 55%,
    var(--violet)
  );
  border-radius: 10px 4px 10px 4px;
  box-shadow: 0 8px 20px rgba(54, 112, 255, 0.3);
}
.crm-link:hover,
.crm-link.active {
  background: linear-gradient(
    90deg,
    rgba(53, 111, 255, 0.28),
    rgba(108, 93, 245, 0.11)
  );
  box-shadow: inset 2px 0 var(--cyan);
}
.crm-topbar {
  background: rgba(255, 255, 255, 0.87);
  backdrop-filter: blur(18px);
}
.crm-button {
  background: linear-gradient(135deg, #3d7cff, #3159dc 58%, #6d5df5);
  border-radius: 9px;
  box-shadow: 0 9px 24px rgba(43, 91, 202, 0.18);
}
.stat,
.panel {
  border-radius: 14px;
  box-shadow: 0 15px 45px rgba(26, 56, 105, 0.065);
}
.stat {
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -35px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(79, 216, 255, 0.17),
    rgba(108, 93, 245, 0.04) 70%
  );
}
.analytics-tabs,
.settings-tabs {
  display: flex;
  gap: 7px;
  overflow: auto;
  padding: 5px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  width: max-content;
  max-width: 100%;
}
.analytics-tabs button,
.settings-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 14px;
  border-radius: 8px;
  font-weight: 700;
  white-space: nowrap;
}
.analytics-tabs button.active,
.settings-tabs button.active {
  background: #0d2148;
  color: #fff;
  box-shadow: 0 8px 20px rgba(13, 33, 72, 0.18);
}
.analytics-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 20px;
}
.bar-list {
  padding: 22px;
  display: grid;
  gap: 20px;
}
.bar-list div {
  display: grid;
  grid-template-columns: 90px 1fr 35px;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}
.bar-list i {
  height: 9px;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}
.funnel {
  padding: 28px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.funnel div {
  min-height: 95px;
  display: grid;
  place-items: center;
  align-content: center;
  color: #fff;
  background: linear-gradient(140deg, #102958, #315fd0);
  clip-path: polygon(0 0, 100% 9%, 91% 100%, 9% 100%);
}
.funnel div:nth-child(2) {
  opacity: 0.91;
}
.funnel div:nth-child(3) {
  opacity: 0.82;
}
.funnel div:nth-child(4) {
  opacity: 0.73;
}
.funnel div:nth-child(5) {
  opacity: 0.65;
}
.funnel strong {
  font-size: 24px;
}
.funnel span {
  font-size: 12px;
}
.health-banner {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-color: #bcd8ff;
  background: linear-gradient(120deg, #f6fbff, #f6f4ff);
}
.health-banner p {
  color: var(--muted);
  margin: 6px 0 0;
}
.health-banner > strong {
  font-size: 30px;
  color: var(--blue-dark);
}
.health-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #20bf7a;
  border-radius: 50%;
  margin-right: 9px;
  box-shadow: 0 0 0 6px rgba(32, 191, 122, 0.1);
}
.settings-panel {
  padding: 0 28px;
}
.settings-section {
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}
.settings-section:last-child {
  border-bottom: 0;
}
.settings-section h2 {
  margin: 0 0 5px;
  font-size: 21px;
}
.settings-section > p:not(.crm-kicker) {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}
.crm-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 850;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.settings-grid .wide {
  grid-column: 1/-1;
}
.settings-section label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-top: 14px;
}
.settings-section input,
.settings-section textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  border: 1px solid #cbd8e8;
  background: #fff;
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
}
.settings-section textarea {
  min-height: 105px;
  resize: vertical;
}
.hours-list {
  display: grid;
  gap: 10px;
}
.hours-row {
  display: grid;
  grid-template-columns: 120px minmax(120px, 1fr) 24px minmax(120px, 1fr) 95px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbfe;
}
.hours-row input {
  margin: 0;
}
.hours-row.closed { opacity: 0.65; }
.hours-row.closed input[type="time"] { background: #edf1f6; }
.closed-toggle { display: flex !important; align-items: center; gap: 7px; margin: 0 !important; }
.closed-toggle input { width: 17px; height: 17px; }
.hours-copy { margin: 14px 0; }
.datetime-picker { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center; margin-top: 7px; }
.datetime-picker input { margin: 0; }
.datetime-shortcuts { display: flex; gap: 6px; }
.datetime-shortcuts button { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: #f7faff; color: var(--blue-dark); font-weight: 750; cursor: pointer; }
.command-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 14px 42px rgba(26, 56, 105, 0.06);
}
.command-metrics span {
  color: var(--muted);
}
.command-metrics b {
  color: var(--text);
  margin-left: 5px;
}
.command-ok {
  background: linear-gradient(120deg, #f7fbff, #f5f7ff);
}
@media (max-width: 760px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  .funnel {
    grid-template-columns: 1fr;
  }
  .funnel div {
    clip-path: none;
    border-radius: 8px;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .settings-grid .wide {
    grid-column: auto;
  }
  .hours-row { grid-template-columns: 1fr 1fr; }
  .hours-row strong, .hours-row .closed-toggle { grid-column: 1 / -1; }
  .hours-row > span { display: none; }
  .datetime-picker { grid-template-columns: 1fr 1fr; }
  .datetime-shortcuts { grid-column: 1 / -1; }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
a {
  text-decoration: none;
  color: inherit;
}
button,
input,
select,
textarea {
  font: inherit;
}

.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: #f5f8ff; }
.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 12, 30, 0.68);
  backdrop-filter: blur(7px);
}
.modal-backdrop[hidden] { display: none; }
.record-modal {
  width: min(720px, 100%);
  max-height: min(820px, 92vh);
  overflow: auto;
  border: 1px solid #d9e3f1;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(0, 18, 51, 0.3);
}
.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}
.modal-head h2 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.record-form { padding: 24px; }
.record-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.record-form label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.record-form label.wide { grid-column: 1 / -1; }
.record-form input,
.record-form select,
.record-form textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd8e8;
  border-radius: 9px;
  background: #fff;
  padding: 10px 12px;
  color: var(--text);
}
.record-form textarea { min-height: 110px; resize: vertical; }
.record-form input,
.record-form select,
.record-form textarea { font: inherit; font-weight: 450; }
.estimate-items-editor {
  display: grid;
  gap: 10px;
  border: 1px solid #d5e0ed;
  border-radius: 12px;
  background: #f8faff;
  padding: 14px;
}
.estimate-item-heading,
.estimate-item-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 75px 120px 34px;
  gap: 8px;
  align-items: center;
}
.estimate-item-heading { padding: 0 4px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.estimate-item-row input { min-height: 40px; }
.estimate-remove-item {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #e0b8bd;
  border-radius: 8px;
  background: #fff5f5;
  color: #b4232f;
  font-size: 19px;
  cursor: pointer;
}
.estimate-add-item { justify-self: start; }
.estimate-editor-summary { border-top: 1px solid #dae4f0; padding-top: 11px; color: var(--blue-dark); font-size: 12px; font-weight: 650; text-align: right; }
.focus-panel { overflow: hidden; }
.focus-panel .panel-head > div { min-width: 0; }
.focus-panel .crm-kicker { margin: 0 0 4px; }
.focus-list { display: grid; }
.focus-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  min-height: 74px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
}
.focus-row:last-child { border-bottom: 0; }
.focus-marker { width: 9px; height: 9px; border-radius: 50%; background: #6f8aaa; box-shadow: 0 0 0 4px #edf2f8; }
.focus-row.priority-high .focus-marker { background: #ee7b24; box-shadow: 0 0 0 4px #fff0e5; }
.focus-row.priority-urgent .focus-marker { background: #d92d3b; box-shadow: 0 0 0 4px #ffe8eb; }
.focus-row > div { display: grid; min-width: 0; gap: 3px; }
.focus-row small { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.focus-row strong { overflow: hidden; color: var(--text); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.focus-row > div > span { color: var(--muted); font-size: 12px; }
.focus-empty { display: grid; place-items: center; gap: 5px; min-height: 130px; padding: 25px; color: var(--muted); text-align: center; }
.focus-empty strong { color: var(--text); font-size: 16px; }
.focus-empty span { font-size: 13px; }
.crm-table tr.task-overdue td:first-child { box-shadow: inset 3px 0 #d92d3b; }
.crm-table tr.task-overdue td:first-child::after { content: "Overdue"; display: inline-flex; margin-left: 8px; padding: 2px 7px; border-radius: 999px; background: #ffe8eb; color: #a71928; font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.crm-table tr.task-priority-urgent:not(.task-overdue) td:first-child { box-shadow: inset 3px 0 #ee7b24; }
.communication-note strong { color: var(--text); }
.communication-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .65fr); gap: 20px; align-items: start; }
.communication-main { min-width: 0; }
.communication-main #conversations-content { min-width: 0; }
.template-panel { position: sticky; top: 88px; max-height: calc(100vh - 112px); overflow: auto; }
.template-panel .panel-head { gap: 12px; }
.template-list { display: grid; }
.template-card { display: grid; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.template-card:last-child { border-bottom: 0; }
.template-card > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.template-card strong { color: var(--text); font-size: 13px; }
.template-card > div > span { padding: 3px 7px; border-radius: 999px; background: #eaf1ff; color: var(--blue-dark); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.template-card p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.template-edit { border: 0; background: transparent; color: var(--blue-dark); font: inherit; font-size: 11px; font-weight: 750; cursor: pointer; }
.template-variable-help { margin: 14px 0 0; padding: 10px 12px; border: 1px solid #d7e2f0; border-radius: 9px; background: #f7faff; color: var(--muted); font-size: 11px; line-height: 1.5; }
.template-missing-warning { margin: 0; color: #9d4313; font-size: 12px; font-weight: 650; }
.template-missing-warning[hidden] { display: none; }
.schedule-create, .schedule-nav, .schedule-toolbar, .schedule-alerts { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.schedule-toolbar { justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.schedule-toolbar h2 { margin: 0; color: var(--text); font-size: 17px; }
.schedule-nav button { min-height: 38px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); cursor: pointer; }
.schedule-nav button:hover, .schedule-nav button:focus-visible { border-color: var(--blue); outline: 2px solid transparent; }
.schedule-filter { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.schedule-filter select { min-height: 38px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
.schedule-alerts { padding: 0 20px; }
.schedule-alerts:empty { display: none; }
.schedule-notice { margin-top: 13px; padding: 8px 11px; border: 1px solid #ecb9bf; border-radius: 8px; background: #fff1f2; color: #93272f; font-size: 12px; font-weight: 750; cursor: pointer; }
.schedule-notice.muted { border-color: var(--line); background: #f6f9fe; color: var(--muted); }
.schedule-load-error { width: 100%; margin: 13px 0 0; padding: 11px; border: 1px solid #e8a2a8; border-radius: 8px; background: #fff1f2; color: #93272f; font-size: 12px; }
.schedule-grid { display: grid; grid-template-columns: repeat(7, minmax(160px, 1fr)); overflow-x: auto; }
.schedule-day { min-height: 270px; padding: 12px 9px 22px; border-right: 1px solid var(--line); }
.schedule-day:last-child { border-right: 0; }
.schedule-day.is-today { background: #f2f6ff; }
.schedule-day h3 { margin: 0 0 14px; padding: 4px 7px; color: var(--text); font-size: 12px; }
.schedule-empty { margin: 15px 7px; color: var(--muted); font-size: 11px; }
.schedule-entry { display: grid; width: 100%; gap: 4px; margin-bottom: 8px; padding: 10px; border: 1px solid #c7d9f9; border-radius: 9px; background: #edf4ff; color: var(--text); text-align: left; cursor: pointer; }
.schedule-entry:hover, .schedule-entry:focus-visible { border-color: var(--blue); outline: 2px solid var(--blue); outline-offset: 1px; }
.schedule-entry small { color: #315fbd; font-size: 10px; font-weight: 800; }
.schedule-entry strong { overflow-wrap: anywhere; font-size: 12px; }
.schedule-entry span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.schedule-entry.schedule-task { border-color: #b8e2da; background: #eaf8f4; }
.schedule-entry.schedule-task small { color: #176c59; }
.schedule-entry.is-conflict { border-color: #e8a2a8; background: #fff0f1; }
.schedule-entry em { color: #a2212d; font-size: 10px; font-style: normal; font-weight: 800; }
.schedule-limits { margin: 0; padding: 11px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
@media (max-width: 850px) { .schedule-grid { grid-template-columns: repeat(7, minmax(195px, 1fr)); } }
@media (max-width: 600px) { .schedule-grid { grid-template-columns: 1fr; } .schedule-day { min-height: 85px; border-right: 0; border-bottom: 1px solid var(--line); } .schedule-toolbar { align-items: flex-start; flex-direction: column; } }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.crm-button.danger { margin-right: auto; background: #c92a2a; }
.mini-action {
  border: 1px solid #b9c9e0;
  border-radius: 7px;
  background: #fff;
  padding: 7px 10px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.mini-action:hover { background: #edf4ff; }
.analytics-anchor,
.settings-section { scroll-margin-top: 90px; }
.analytics-total {
  display: block;
  margin-top: 12px;
  font-size: 32px;
  color: var(--blue-dark);
}
@media (max-width: 700px) {
  .record-form-grid { grid-template-columns: 1fr; }
  .record-form label.wide { grid-column: auto; }
  .estimate-item-heading { display: none; }
  .estimate-item-row { grid-template-columns: 1fr 70px 105px 34px; }
  .estimate-item-row input:first-child { grid-column: 1 / -1; }
  .focus-row { grid-template-columns: 10px minmax(0, 1fr); padding: 14px; }
  .focus-row > button { grid-column: 2; justify-self: start; }
}
.crm-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 235px 1fr;
}
.crm-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 235px;
  background: linear-gradient(180deg, var(--navy), #081a38);
  color: #d8e4fb;
  padding: 20px 14px;
  overflow: auto;
}
.crm-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 850;
  padding: 3px 10px 24px;
}
.crm-logo span {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  background: var(--blue);
  border-radius: 8px;
}
.crm-nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #6f86ae;
  padding: 18px 12px 8px;
}
.crm-nav {
  display: grid;
  gap: 4px;
}
.crm-link {
  padding: 10px 12px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 14px;
  color: #afc0dc;
}
.crm-link:hover,
.crm-link.active {
  color: #fff;
  background: #123367;
}
.crm-icon {
  width: 20px;
  text-align: center;
}
.crm-sidebar-foot {
  margin-top: 30px;
  border-top: 1px solid #17335b;
  padding-top: 15px;
}
.crm-main {
  grid-column: 2;
  min-width: 0;
}
.crm-topbar {
  height: 68px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.crumb {
  font-size: 13px;
  color: var(--muted);
}
.crm-top-actions {
  display: flex;
  align-items: center;
  gap: 13px;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e6efff;
  color: var(--blue-dark);
  font-weight: 800;
}
.crm-content {
  padding: 30px;
  max-width: 1500px;
  margin: auto;
}
.quick-create {
  display: grid;
  grid-template-columns: auto repeat(6, minmax(118px, 1fr));
  align-items: stretch;
  gap: 9px;
  margin-bottom: 24px;
}
.quick-create-label {
  display: grid;
  place-items: center;
  padding: 0 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.quick-create button {
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  min-width: 0;
  border: 1px solid #cfdbec;
  border-radius: 11px;
  background: linear-gradient(145deg, #fff, #f6f9ff);
  padding: 10px 11px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 7px 20px rgba(26, 56, 105, 0.055);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.quick-create button:hover,
.quick-create button:focus-visible {
  transform: translateY(-2px);
  border-color: #78a4ff;
  box-shadow: 0 11px 25px rgba(43, 91, 202, 0.14);
  outline: none;
}
.quick-create button > span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #e9f1ff;
  color: var(--blue-dark);
  font-size: 15px;
  font-weight: 750;
}
.quick-create button:nth-of-type(2) > span { background: #e9f8f2; color: #087a58; }
.quick-create button:nth-of-type(3) > span { background: #f1edff; color: #6547cf; }
.quick-create button:nth-of-type(4) > span { background: #e9f8fc; color: #087991; }
.quick-create button:nth-of-type(5) > span { background: #fff3e5; color: #a15b05; }
.quick-create button:nth-of-type(6) > span { background: #f2edff; color: #6945ca; }
.quick-create button b { align-self: end; font-size: 13px; font-weight: 700; }
.quick-create button small { align-self: start; color: var(--muted); font-size: 10px; }
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}
.page-head h1 {
  margin: 0 0 7px;
  font-size: 28px;
  letter-spacing: -0.03em;
}
.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.crm-button {
  border: 0;
  background: var(--blue);
  color: #fff;
  font-weight: 750;
  border-radius: 7px;
  padding: 11px 17px;
  cursor: pointer;
}
.crm-button:hover {
  background: var(--blue-dark);
}
.crm-button.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 18px;
}
.stat small {
  color: var(--muted);
  font-weight: 600;
}
.stat strong {
  display: block;
  font-size: 27px;
  margin-top: 8px;
}
.stat em {
  font-style: normal;
  font-size: 12px;
  color: #12a36c;
}
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 20px;
}
.panel-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-head h2 {
  font-size: 16px;
  margin: 0;
}
.panel-body {
  padding: 20px;
}
.activity {
  height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: linear-gradient(#fff, #f8fbff);
}
.activity-graph {
  width: 90%;
  height: 120px;
  border-bottom: 2px solid #d6e3fb;
  position: relative;
}
.activity-graph:before {
  content: "";
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: 20px;
  height: 70px;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(
    180deg,
    rgba(23, 105, 255, 0.22),
    rgba(23, 105, 255, 0.02)
  );
  clip-path: polygon(
    0 92%,
    12% 65%,
    22% 76%,
    34% 28%,
    46% 59%,
    57% 39%,
    67% 69%,
    78% 18%,
    89% 49%,
    100% 10%,
    100% 100%,
    0 100%
  );
}
.toolbar {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.collection-toolbar .result-count {
  margin-left: auto;
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 18px;
  color: var(--muted);
  font-size: 12px;
}
.pager button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 7px 11px;
  cursor: pointer;
}
.pager button:disabled { cursor: not-allowed; opacity: 0.45; }
.contact-history {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.contact-history h3 { margin: 0 0 12px; }
.history-list { display: grid; gap: 8px; color: var(--muted); }
.history-list > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}
.history-list span { color: var(--text); }
.history-list small { text-transform: capitalize; }
.activity-bars {
  width: 90%;
  height: 130px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding: 8px 0;
  border-bottom: 2px solid #d6e3fb;
}
.activity-bars span {
  flex: 1;
  min-height: 5px;
  border-radius: 5px 5px 1px 1px;
  background: linear-gradient(180deg, var(--cyan), var(--blue));
  opacity: 0.82;
}
.search {
  height: 39px;
  min-width: 250px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
}
.filter {
  height: 39px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 12px;
}
.table-wrap {
  overflow: auto;
}
.crm-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
.crm-table th,
.crm-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.crm-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: #fafbfd;
}
.person {
  display: flex;
  align-items: center;
  gap: 10px;
}
.person-dot {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e7efff;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 800;
}
.badge {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 750;
  background: #e8f0ff;
  color: #1759ca;
}
.badge.new {
  background: #e6f9f0;
  color: #078755;
}
.badge.warm {
  background: #fff4d7;
  color: #9a6800;
}
.empty {
  padding: 75px 25px;
  text-align: center;
}
.empty-icon {
  width: 55px;
  height: 55px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eaf1ff;
  color: var(--blue);
  font-size: 23px;
}
.empty h3 {
  margin: 0 0 7px;
}
.empty p {
  max-width: 430px;
  margin: 0 auto 18px;
  color: var(--muted);
  font-size: 14px;
}
.conversation-layout {
  display: grid;
  grid-template-columns: 330px 1fr 275px;
  min-height: 570px;
}
.thread-list {
  border-right: 1px solid var(--line);
}
.thread {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.thread.active {
  background: #f1f6ff;
  border-left: 3px solid var(--blue);
}
.thread b {
  font-size: 14px;
}
.thread p {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 5px 0;
}
.messages {
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.message-space {
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}
.composer {
  display: flex;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}
.composer input {
  flex: 1;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
}
.contact-detail {
  border-left: 1px solid var(--line);
  padding: 20px;
}
.detail-row {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.detail-row small {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
}
.mobile-menu {
  display: none;
}
.view {
  display: none;
}
.view.active {
  display: block;
}
@media (max-width: 900px) {
  .crm-shell {
    grid-template-columns: 1fr;
  }
  .crm-sidebar {
    transform: translateX(-100%);
    transition: 0.2s;
    z-index: 30;
  }
  .crm-sidebar.open {
    transform: none;
  }
  .crm-main {
    grid-column: 1;
  }
  .mobile-menu {
    display: block;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
  .conversation-layout {
    grid-template-columns: 280px 1fr;
  }
  .contact-detail {
    display: none;
  }
  .quick-create { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-create-label { grid-column: 1 / -1; place-items: start; padding: 0; }
  .communication-layout { grid-template-columns: 1fr; }
  .template-panel { position: static; max-height: none; }
}
@media (max-width: 600px) {
  .crm-content {
    padding: 20px 14px;
  }
  .crm-topbar {
    padding: 0 14px;
  }
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }
  .quick-create { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 5px; scroll-snap-type: x proximity; }
  .quick-create-label { display: none; }
  .quick-create button { flex: 0 0 145px; scroll-snap-align: start; }
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .conversation-layout {
    grid-template-columns: 1fr;
  }
  .thread-list {
    display: none;
  }
}
