/* MCN 机构搜索 · 全屏分析弹层 */

body.mad-open {
  overflow: hidden;
}

.mad-modal[hidden] {
  display: none !important;
}

.mad-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 10vw;
}

.mad-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.mad-panel {
  position: relative;
  margin: 0;
  width: min(968px, calc(100vw - 18vw));
  height: min(990px, calc(100vh - 24px));
  background: #f5f6fb;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mad-panel:focus {
  outline: none;
}

.mad-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 32px;
  background: #fff;
  border-bottom: 1px solid #eef2f7;
  flex-shrink: 0;
}

.mad-logo,
.mad-logo-fallback {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: #eef2ff;
  flex-shrink: 0;
}

.mad-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.mad-head-meta {
  min-width: 0;
  flex: 1;
}

.mad-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mad-name {
  font-size: 16px;
  font-weight: 650;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mad-cert {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  background: #3c66ff;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

.mad-sub {
  margin-top: 2px;
  font-size: 12px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mad-contact,
.mad-close {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.mad-contact {
  height: 32px;
  padding: 0 12px;
}

.mad-close {
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  color: #94a3b8;
}

.mad-close:hover,
.mad-contact:hover {
  border-color: #cbd5e1;
  color: #0f172a;
}

.mad-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 32px;
  background: #fff;
  border-bottom: 1px solid #eef2f7;
  flex-shrink: 0;
}

.mad-tab {
  height: 46px;
  padding: 0 16px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  position: relative;
}

.mad-tab.is-active {
  color: #3c66ff;
  font-weight: 650;
}

.mad-tab.is-active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  background: #3c66ff;
  border-radius: 2px 2px 0 0;
}

.mad-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px 36px 28px;
  scrollbar-width: thin;
  scrollbar-color: #c5cdd6 transparent;
}

.mad-body::-webkit-scrollbar {
  width: 5px;
}

.mad-body::-webkit-scrollbar-track {
  background: transparent;
}

.mad-body::-webkit-scrollbar-thumb {
  background: #c5cdd6;
  border-radius: 8px;
}

.mad-empty,
.mad-loading,
.mad-error {
  padding: 64px 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

.mad-error {
  color: #ef4444;
}

.mad-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.mad-kpi {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  padding: 14px 16px;
}

.mad-kpi-label {
  font-size: 12px;
  color: #64748b;
}

.mad-kpi-val {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 650;
  color: #0f172a;
}

.mad-kpi-sub {
  margin-top: 4px;
  font-size: 11px;
  color: #94a3b8;
}

.mad-kpi-rank {
  margin-top: 6px;
  font-size: 11px;
  color: #3c66ff;
}

.mad-grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.mad-grid-2.equal {
  grid-template-columns: 1fr 1fr;
}

.mad-card {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  padding: 14px 16px;
}

.mad-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 10px;
}

.mad-chart {
  min-height: 180px;
}

.mad-donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mad-donut {
  width: 132px;
  height: 132px;
  flex-shrink: 0;
}

.mad-legend {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mad-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #475569;
}

.mad-legend-item span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mad-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.mad-filters {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.mad-filter-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.mad-filter-row:last-child {
  margin-bottom: 0;
}

.mad-filter-label {
  width: 72px;
  flex-shrink: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 28px;
}

.mad-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mad-chip {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #e8ecf3;
  background: #fff;
  border-radius: 14px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
}

.mad-chip.is-active {
  border-color: #3c66ff;
  color: #3c66ff;
  background: #eef2ff;
}

.mad-search {
  display: flex;
  gap: 8px;
  flex: 1;
}

.mad-search input {
  flex: 1;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #e8ecf3;
  border-radius: 8px;
  font-size: 12px;
}

.mad-search button {
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: #3c66ff;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
}

.mad-days {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mad-day {
  height: 30px;
  padding: 0 12px;
  border: 1px solid #e8ecf3;
  background: #fff;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  color: #475569;
}

.mad-day.is-active {
  border-color: #3c66ff;
  color: #3c66ff;
  background: #eef2ff;
}

.mad-table-wrap {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  overflow: auto;
}

.mad-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.mad-table th,
.mad-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  vertical-align: middle;
  color: #334155;
}

.mad-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 1;
}

.mad-person {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mad-avatar,
.mad-avatar-fallback,
.mad-cover,
.mad-cover-fallback,
.mad-brand-logo,
.mad-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #eef2ff;
  flex-shrink: 0;
}

.mad-cover,
.mad-cover-fallback {
  width: 56px;
  height: 56px;
  border-radius: 8px;
}

.mad-brand-logo,
.mad-brand-mark {
  border-radius: 8px;
}

.mad-brand-mark,
.mad-avatar-fallback,
.mad-cover-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3c66ff;
  font-weight: 650;
}

.mad-nick {
  font-weight: 600;
  color: #0f172a;
}

.mad-redid {
  font-size: 11px;
  color: #94a3b8;
}

.mad-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mad-tag {
  padding: 1px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
}

.mad-op {
  color: #3c66ff;
  text-decoration: none;
  font-weight: 500;
}

.mad-op:hover {
  text-decoration: underline;
}

.mad-note-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.mad-note-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 220px;
}

.mad-note-body {
  min-width: 0;
}

.mad-note-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 600;
  color: #0f172a;
}

.mad-note-chip {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  height: 18px;
  border-radius: 4px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.mad-note-sub {
  margin-top: 2px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}

.mad-sort {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.mad-sort:hover,
.mad-sort.is-active {
  color: #4f46e5;
  font-weight: 650;
}

.mad-chart-wide {
  min-height: 280px;
}

.tdt-comment-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 11px;
  color: #64748b;
}

.tdt-comment-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tdt-comment-legend-item i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.mad-perf {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.mad-perf-item {
  text-align: center;
}

.mad-perf-val {
  font-size: 16px;
  font-weight: 650;
  color: #0f172a;
}

.mad-perf-avg {
  font-size: 11px;
  color: #94a3b8;
}

.mad-perf-lbl {
  margin-top: 2px;
  font-size: 11px;
  color: #64748b;
}

.mad-footer-hint {
  padding: 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}

.mad-toast {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  z-index: 3;
}

@media (max-width: 720px) {
  .mad-grid-2,
  .mad-grid-2.equal,
  .mad-kpis,
  .mad-perf {
    grid-template-columns: 1fr;
  }

  .mad-modal {
    padding: 0;
  }

  .mad-panel {
    margin: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
}
