:root {
  --bg: #070b14;
  --card: #0f1626;
  --card-2: #121c30;
  --line: #1f345a;
  --text: #d7e9ff;
  --muted: #85a2c8;
  --accent: #35d0ff;
  --accent-2: #7d8bff;
  --ok: #44f0a6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 15% 20%, #112347 0%, transparent 30%),
    radial-gradient(circle at 85% 5%, #1b2d56 0%, transparent 35%),
    var(--bg);
  color: var(--text);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(75, 120, 170, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(75, 120, 170, 0.1) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  opacity: 0.25;
}

.dashboard {
  position: relative;
  max-width: min(1880px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 14px 12px 24px;
}

.card {
  background: linear-gradient(135deg, rgba(20, 30, 52, 0.95), rgba(12, 18, 34, 0.95));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: inset 0 0 0 1px rgba(90, 130, 180, 0.12), 0 16px 32px rgba(0, 0, 0, 0.28);
}

.tabs {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  padding: 10px;
}

.tab-btn {
  min-width: 140px;
}

.tab-btn.is-active {
  border-color: var(--accent);
  color: #ecf6ff;
  box-shadow: 0 0 0 1px rgba(53, 208, 255, 0.25) inset;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.6px;
}

h2 {
  margin: 0 0 10px;
  font-size: 18px;
  color: #c8ddff;
}

h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

button,
input,
select {
  background: var(--card-2);
  border: 1px solid #2d4a79;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
}

button {
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

.kpi-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.kpi .num {
  margin-top: 8px;
  font-size: 30px;
  color: #ecf6ff;
  font-weight: 700;
}

.grid-two {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.grid-two > .card {
  min-width: 0;
}

.chart {
  width: 100%;
  height: 280px;
  background: rgba(8, 12, 24, 0.65);
  border: 1px solid #22385f;
  border-radius: 10px;
}

.chart-pie {
  height: 320px;
}

.bars {
  display: grid;
  gap: 10px;
}

.reply-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.reply-kpi {
  background: rgba(15, 30, 54, 0.7);
  border: 1px solid #27406a;
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 4px;
}

.reply-kpi span {
  color: var(--muted);
  font-size: 12px;
}

.reply-kpi strong {
  color: #ecf6ff;
  font-size: 22px;
}

.reply-wrap {
  max-height: 280px;
}

.reply-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.reply-badge.is-bounce {
  background: rgba(255, 87, 87, 0.15);
  border: 1px solid rgba(255, 87, 87, 0.5);
  color: #ffb7b7;
}

.reply-badge.is-reply {
  background: rgba(68, 240, 166, 0.14);
  border: 1px solid rgba(68, 240, 166, 0.45);
  color: #aaf4d1;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.bar-track {
  height: 12px;
  background: #0b1222;
  border: 1px solid #2e4770;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.simple-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #22395e;
  text-align: left;
  padding: 8px 6px;
  font-size: 13px;
  vertical-align: top;
}

th {
  color: #97b7de;
  font-weight: 600;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.filters {
  display: flex;
  gap: 8px;
}

#searchInput {
  min-width: 320px;
}

.table-wrap {
  margin-top: 10px;
  max-height: 540px;
  overflow: auto;
  width: 100%;
}

.data-table {
  table-layout: fixed;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #101a2d;
}

.data-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table th:nth-child(1), .data-table td:nth-child(1) { width: 120px; }
.data-table th:nth-child(2), .data-table td:nth-child(2) { width: 210px; }
.data-table th:nth-child(3), .data-table td:nth-child(3) { width: 170px; }
.data-table th:nth-child(4), .data-table td:nth-child(4) { width: 80px; }
.data-table th:nth-child(5), .data-table td:nth-child(5) { width: 210px; }
.data-table th:nth-child(6), .data-table td:nth-child(6) { width: 170px; }
.data-table th:nth-child(7), .data-table td:nth-child(7) { width: 80px; }
.data-table th:nth-child(8), .data-table td:nth-child(8) { width: 200px; }
.data-table th:nth-child(9), .data-table td:nth-child(9) { width: 120px; }

.lead-table th:nth-child(1), .lead-table td:nth-child(1) { width: 140px; }
.lead-table th:nth-child(2), .lead-table td:nth-child(2) { width: 180px; }
.lead-table th:nth-child(3), .lead-table td:nth-child(3) { width: 130px; }
.lead-table th:nth-child(4), .lead-table td:nth-child(4) { width: 90px; }
.lead-table th:nth-child(5), .lead-table td:nth-child(5) { width: 180px; }
.lead-table th:nth-child(6), .lead-table td:nth-child(6) { width: 150px; }
.lead-table th:nth-child(7), .lead-table td:nth-child(7) { width: 160px; }
.lead-table th:nth-child(8), .lead-table td:nth-child(8) { width: 260px; }
.lead-table th:nth-child(9), .lead-table td:nth-child(9) { width: 190px; }
.lead-table td:nth-child(9) { white-space: nowrap; overflow: visible; text-overflow: clip; }

.pager {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

a {
  color: var(--accent);
}

@media (max-width: 1200px) {
  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .reply-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-two {
    grid-template-columns: 1fr;
  }
  #searchInput {
    min-width: 180px;
  }
}


.lead-table td.full-time-cell {
  width: 220px !important;
  max-width: none !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
}


.view-push-btn {
  padding: 4px 8px;
  font-size: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.modal.hidden {
  display: none;
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-card {
  position: relative;
  width: min(1200px, 92vw);
  max-height: 90vh;
  overflow: auto;
  margin: 4vh auto;
  background: #0f1626;
  border: 1px solid #2d4a79;
  border-radius: 12px;
  padding: 14px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.modal-meta {
  color: var(--muted);
  margin-bottom: 10px;
  font-size: 13px;
}

.modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.modal-pre {
  background: #0b1222;
  border: 1px solid #2e4770;
  border-radius: 8px;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
  margin: 0;
}

.modal-iframe {
  width: 100%;
  height: 360px;
  border: 1px solid #2e4770;
  border-radius: 8px;
  background: #fff;
}

.modal-close {
  padding: 6px 10px;
}

@media (max-width: 1200px) {
  .modal-grid {
    grid-template-columns: 1fr;
  }
}


.simple-table {
  table-layout: fixed;
}

.simple-table th,
.simple-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


@media (max-width: 1500px) {
  .grid-two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .bg-grid {
    opacity: 0.12;
  }

  .dashboard {
    max-width: 100vw;
    padding: 10px 8px 16px;
  }

  .card {
    border-radius: 12px;
    padding: 10px;
  }

  .topbar {
    display: grid;
    gap: 8px;
    align-items: start;
  }

  h1 {
    font-size: 20px;
    letter-spacing: 0.2px;
  }

  h2 {
    font-size: 16px;
  }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 8px;
    gap: 6px;
  }

  .tab-btn {
    min-width: 108px;
    padding: 8px 10px;
    white-space: nowrap;
  }

  .kpi-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .kpi .num {
    font-size: 24px;
  }

  .reply-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .list-header {
    display: grid;
    gap: 8px;
  }

  .filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    width: 100%;
  }

  input,
  select,
  button {
    min-height: 38px;
    font-size: 14px;
  }

  #searchInput,
  #leadSearchInput,
  #ghSearchInput {
    min-width: 0;
    width: 100%;
  }

  .chart {
    height: 220px;
  }

  .chart-pie {
    height: 260px;
  }

  .table-wrap {
    max-height: 56vh;
    border: 1px solid #22395e;
    border-radius: 10px;
  }

  th,
  td {
    font-size: 12px;
    padding: 7px 6px;
  }

  .pager {
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
  }

  .modal-card {
    width: 96vw;
    max-height: 92vh;
    margin: 2vh auto;
    padding: 10px;
  }

  .modal-iframe {
    height: 300px;
  }
}

@media (max-width: 420px) {
  .reply-kpis {
    grid-template-columns: 1fr;
  }

  .chart {
    height: 200px;
  }

  .chart-pie {
    height: 220px;
  }

  .tab-btn {
    min-width: 96px;
    font-size: 12px;
  }
}
