/* North Star Metrics dashboard — Clonk palette */

.nsm-page {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #FAFAFA;
  min-height: 100vh;
  color: #2F3133;
  padding-top: 70px;
  padding-bottom: 96px;
}

/* ═══ HEADER ═══ */
.nsm-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  animation: nsm-fade-in 0.3s ease-out;
}
.nsm-title {
  font-size: 18px;
  font-weight: 800;
  color: #1C1D1F;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.nsm-subtitle-tag {
  font-size: 11px;
  font-weight: 600;
  color: #8D9095;
  margin-left: 10px;
  letter-spacing: 0.02em;
}
.nsm-header-meta {
  font-size: 12px;
  color: #8D9095;
  margin: 0;
}
.nsm-company-name { color: #F11228; }

.nsm-pill:focus,
.nsm-clear-btn:focus {
  outline: none;
}

/* ═══ STICKY REGION (header + filters + cards) ═══ */
/* top: 70px matches the height of the global Clonk header
   (`.sticky` rule in template-260507.css) so this region pins
   right below it instead of overlapping. */
.nsm-sticky-region {
  position: sticky;
  top: 70px;
  z-index: 5;
  background: #FAFAFA;
  padding-top: 20px;
  padding-bottom: 8px;
}

/* ═══ FILTERS ═══ */
.nsm-filters-bar {
  max-width: 1200px;
  margin: 16px auto 0;
  padding: 0 20px;
  background: transparent;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
  animation: nsm-fade-in 0.3s ease-out 0.1s both;
}
.nsm-filters-bar > .nsm-filter-group,
.nsm-filters-bar > .nsm-filter-clear {
  background: #FFFFFF;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 12px 16px;
}
.nsm-filter-label {
  font-size: 10px;
  font-weight: 700;
  color: #767980;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.nsm-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.nsm-pill {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  color: #767980;
  background: transparent;
  border: 1px solid #D1D2D5;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}
.nsm-pill.nsm-active {
  font-weight: 700 !important;
  color: #AB1D2E !important;
  background: #FEE6E8 !important;
  border-color: #F98E9A !important;
}
.nsm-filter-clear {
  display: flex;
  align-items: center;
}
.nsm-clear-btn {
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 600;
  color: #767980;
  background: transparent;
  border: 1px solid #D1D2D5;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
}
.nsm-clear-btn:hover { color: #2F3133; border-color: #A4A6AB; }

/* ═══ LOADING / ERROR ═══ */
.nsm-loading, .nsm-error {
  max-width: 1200px;
  margin: 24px auto;
  padding: 24px 20px;
  text-align: center;
  font-size: 13px;
  color: #767980;
}
.nsm-error { color: #D20C20; }

/* ═══ METRIC CARDS ═══ */
.nsm-cards-grid {
  max-width: 1200px;
  margin: 14px auto 0;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 900px) {
  .nsm-cards-grid { grid-template-columns: 1fr; }
}
.nsm-card {
  background: #FFFFFF;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
  animation: nsm-slide-up 0.4s ease-out both;
}
.nsm-card-head { padding: 20px 24px 0; }
.nsm-card-title {
  font-size: 10px;
  font-weight: 700;
  color: #767980;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nsm-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}
.nsm-card-value-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}
.nsm-card-value {
  font-size: 32px;
  font-weight: 800;
  color: #1C1D1F;
  line-height: 1;
  letter-spacing: -0.02em;
}
.nsm-change-badge {
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 10px;
}
.nsm-change-badge.positive { color: #199F88; background: #DCF9F5; }
.nsm-change-badge.negative { color: #F11228; background: #FEE6E8; }
.nsm-card-sub {
  font-size: 12px;
  color: #8D9095;
  margin-bottom: 16px;
}
.nsm-card-chart { padding: 0 8px; }

/* ═══ AREA CHART (used by nsmAreaChart directive) ═══ */
.nsm-chart-host {
  position: relative;
  width: 100%;
}
.nsm-chart-svg-wrap { width: 100%; }
.nsm-chart-tooltip {
  position: absolute;
  background: #2F3133;
  color: #FFFFFF;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 5;
}
.nsm-chart-empty {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #A4A6AB;
  font-size: 12px;
}

/* ═══ BANNER ═══ */
.nsm-banner-wrap {
  max-width: 1200px;
  margin: 14px auto 0;
  padding: 0 20px;
}
.nsm-banner {
  padding: 12px 20px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
  animation: nsm-fade-in 0.3s ease-out;
}
.nsm-banner-company {
  background: #FEE6E8;
  border: 1px solid #F98E9A;
  color: #AB1D2E;
}
.nsm-banner-filters {
  background: #FFFBE7;
  border: 1px solid rgba(255, 222, 60, 0.2);
  color: #C6A500;
}

/* ═══ TABLE ═══ */
.nsm-table-section {
  max-width: 1200px;
  margin: 14px auto 0;
  padding: 0 20px;
}
.nsm-table-label {
  font-size: 10px;
  font-weight: 700;
  color: #767980;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 14px 0 10px;
  padding-left: 2px;
}
.nsm-empty {
  background: #FFFFFF;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 48px 20px;
  text-align: center;
  color: #8D9095;
  font-size: 13px;
}
.nsm-empty-icon { font-size: 28px; margin-bottom: 10px; opacity: 0.5; }

.nsm-table {
  background: #FFFFFF;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  animation: nsm-slide-up 0.4s ease-out 0.2s both;
}
.nsm-table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr;
  background: #393A3E;
  padding: 10px 20px;
  position: sticky;
  /* 70px reserves space for the global Clonk header; the offset var
     is the rendered height of .nsm-sticky-region. */
  top: calc(var(--nsm-sticky-offset, 380px) + 70px);
  z-index: 4;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}
.nsm-row:last-child {
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}
.nsm-th {
  font-size: 11px;
  font-weight: 700;
  color: #FFFFFF;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: default;
}
.nsm-th-right {
  text-align: right;
  cursor: pointer;
  user-select: none;
}
.nsm-sort-arrow {
  font-size: 8px;
  margin-left: 4px;
  opacity: 0.3;
}
.nsm-sort-arrow.nsm-active { opacity: 1; }

.nsm-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr;
  padding: 12px 20px;
  border-bottom: 1px solid #E8E9EA;
  align-items: center;
  transition: all 0.2s;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.nsm-row:hover { background: #f8f8f9; }
.nsm-row.selected {
  background: #FEE6E8;
  border-left: 3px solid #F11228;
}
.nsm-row.dimmed { opacity: 0.35; }

.nsm-td { font-size: 12px; color: #4D4F53; }
.nsm-td-name .nsm-company { font-size: 13px; font-weight: 600; color: #2F3133; }
.nsm-td-name .nsm-company-industry { font-size: 10px; color: #8D9095; margin-top: 1px; }
.nsm-num { text-align: right; font-weight: 600; color: #393A3E; font-family: 'Courier New', monospace; }
.nsm-segment { color: #4D4F53; }

.nsm-mom-good { color: #199F88; }
.nsm-mom-bad { color: #DE7A3C; }
.nsm-mom-neutral { color: #424448; }

.nsm-plan-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.nsm-plan-starter { background: #E8E9EA; color: #4D4F53; }
.nsm-plan-pro { background: #DCF9F5; color: #116A5B; }
.nsm-plan-premium { background: #FCE5FD; color: #BF11C2; }
.nsm-plan-default { background: #E8E9EA; color: #4D4F53; }

/* ═══ REFRESH INDICATOR ═══ */
.nsm-spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid #D1D2D5;
  border-top-color: #F11228;
  border-radius: 50%;
  animation: nsm-spin 0.7s linear infinite;
  vertical-align: -1px;
  margin-right: 6px;
}
.nsm-refreshing {
  opacity: 0.5;
  transition: opacity 0.15s ease-out;
  pointer-events: none;
}
@keyframes nsm-spin {
  to { transform: rotate(360deg); }
}

/* ═══ ANIMATIONS ═══ */
@keyframes nsm-fade-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes nsm-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
