/* ==========================================================================
   Admin panel (/admin)
   Written in plain CSS rather than the site's template classes: this is an
   internal tool, and it must not inherit (or disturb) the marketing styles.
   Everything is scoped under .np_adm.
   ========================================================================== */
.np_adm,
.np_adm_login {
  --adm-bg: #F4F7FC;
  --adm-panel: #FFFFFF;
  --adm-ink: #0B2154;
  --adm-muted: #5B6B8C;
  --adm-line: #DCE5F5;
  --adm-blue: #2B6CF0;
  --adm-blue-soft: #EAF1FE;
  --adm-green: #0F9D6B;
  --adm-amber: #B6791A;
  --adm-red: #D2453B;
}
.np_adm {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  background: var(--adm-bg);
  color: var(--adm-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
.np_adm_login *,
.np_adm_login *::before,
.np_adm_login *::after {
  box-sizing: border-box;
}
.np_adm *,
.np_adm *::before,
.np_adm *::after {
  box-sizing: border-box;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.np_adm_side {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  background: #07173F;
  color: #C8D6F0;
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.np_adm_brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #FFFFFF;
  text-decoration: none;
}
.np_adm_brand img {
  height: 34px;
  width: auto;
}
.np_adm_nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.np_adm_nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #C8D6F0;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.np_adm_nav a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #FFFFFF;
}
.np_adm_nav a.is_active {
  background: var(--adm-blue);
  color: #FFFFFF;
}
.np_adm_side_foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  color: #8FA6CE;
}
.np_adm_side_foot a {
  color: #8FA6CE;
}

/* ── Main column ─────────────────────────────────────────────── */
.np_adm_main {
  padding: 30px 34px 60px;
  min-width: 0;
}
.np_adm_head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
.np_adm_head h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}
.np_adm_head p {
  margin: 6px 0 0;
  color: var(--adm-muted);
  font-size: 14px;
}

/* ── Building blocks ─────────────────────────────────────────── */
.np_adm_card {
  background: var(--adm-panel);
  border: 1px solid var(--adm-line);
  border-radius: 14px;
  padding: 20px 22px;
}
.np_adm_card h2,
.np_adm_card h3 {
  margin: 0 0 14px;
  font-size: 15px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--adm-muted);
}
.np_adm_grid {
  display: grid;
  gap: 16px;
}
.np_adm_grid.cols_4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.np_adm_grid.cols_3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.np_adm_grid.cols_2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.np_adm_grid.cols_4 > .np_adm_card,
.np_adm_grid.cols_3 > .np_adm_card {
  display: flex;
  flex-direction: column;
}
.np_adm_stat_value {
  display: block;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
}
.np_adm_stat_label {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--adm-muted);
}
/* Secondary line under a stat — pinned to the bottom so cards in a row keep
   their value and label on the same line as each other. */
.np_adm_stat_foot {
  display: block;
  margin-top: auto;
  padding-top: 6px;
  font-size: 12px;
  color: var(--adm-muted);
}
.np_adm_delta {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
}
.np_adm_delta.up {
  color: var(--adm-green);
}
.np_adm_delta.down {
  color: var(--adm-red);
}

/* ── Tables ──────────────────────────────────────────────────── */
.np_adm_table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.np_adm_table th,
.np_adm_table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--adm-line);
  vertical-align: top;
}
.np_adm_table th {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--adm-muted);
  font-weight: 600;
  white-space: nowrap;
}
.np_adm_table tr:last-child td {
  border-bottom: 0;
}
.np_adm_table td small {
  display: block;
  color: var(--adm-muted);
}
.np_adm_scroll {
  overflow-x: auto;
}
/* A visit with 20 steps would otherwise stretch the table past any screen. */
.np_adm_path {
  max-width: 520px;
  white-space: normal;
}
/* Below this the browser starts squeezing columns into each other; scrolling
   sideways reads better than a crushed table. */
.np_adm_scroll > .np_adm_table {
  min-width: 880px;
}
/* A table that runs edge to edge inside a card still has to line its first and
   last column up with the card's padding. */
.np_adm_card.np_adm_scroll > .np_adm_table th:first-child,
.np_adm_card.np_adm_scroll > .np_adm_table td:first-child,
.np_adm_flush .np_adm_table th:first-child,
.np_adm_flush .np_adm_table td:first-child {
  padding-left: 22px;
}
.np_adm_card.np_adm_scroll > .np_adm_table th:last-child,
.np_adm_card.np_adm_scroll > .np_adm_table td:last-child,
.np_adm_flush .np_adm_table th:last-child,
.np_adm_flush .np_adm_table td:last-child {
  padding-right: 22px;
}
/* Row actions belong on one line — wrapped buttons make every row a different
   height and the column edges ragged. */
.np_adm_table td .np_adm_row {
  flex-wrap: nowrap;
}
/* A card whose table runs edge to edge: the heading and footer carry the
   padding instead. */
.np_adm_flush {
  padding: 0;
}
.np_adm_flush > .np_adm_flush_head {
  padding: 20px 22px 0;
}
.np_adm_flush > .np_adm_flush_foot {
  padding: 14px 22px 20px;
}

/* ── Controls ────────────────────────────────────────────────── */
.np_adm_btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--adm-blue);
  color: #FFFFFF;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.2s, background 0.2s, border-color 0.2s;
}
.np_adm_btn:hover {
  filter: brightness(1.08);
}
.np_adm_btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.np_adm_btn.ghost {
  background: #FFFFFF;
  border-color: var(--adm-line);
  color: var(--adm-ink);
}
.np_adm_btn.danger {
  background: var(--adm-red);
}
.np_adm_btn.small {
  padding: 6px 12px;
  font-size: 13px;
}
.np_adm_field {
  display: block;
  margin-bottom: 16px;
}
.np_adm_field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--adm-muted);
}
.np_adm_input,
.np_adm_select,
.np_adm_textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--adm-line);
  border-radius: 9px;
  background: #FFFFFF;
  color: var(--adm-ink);
  font: inherit;
  font-size: 14px;
}
.np_adm_textarea {
  min-height: 96px;
  resize: vertical;
}
.np_adm_input:focus,
.np_adm_select:focus,
.np_adm_textarea:focus {
  outline: 2px solid rgba(43, 108, 240, 0.35);
  outline-offset: 1px;
  border-color: var(--adm-blue);
}
.np_adm_row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
/* Fields default to width:100%, which in a flex row pushes whatever sits next
   to them (a ✕, a second field) onto its own line. Inside a row they share it. */
.np_adm_row > .np_adm_input,
.np_adm_row > .np_adm_select,
.np_adm_row > .np_adm_textarea {
  flex: 1 1 200px;
  width: auto;
  min-width: 0;
}

/* Password field with a show/hide eye sitting inside its right edge. */
.np_adm_reveal_wrap {
  position: relative;
  display: block;
}
.np_adm_reveal_wrap .np_adm_input {
  padding-right: 42px;
}
.np_adm_reveal {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--adm-muted);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s;
}
.np_adm_reveal:hover {
  color: var(--adm-blue);
}

/* ── Badges ──────────────────────────────────────────────────── */
.np_adm_badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.np_adm_badge.new {
  background: #FDF3E2;
  color: var(--adm-amber);
}
.np_adm_badge.contacted {
  background: #E6F6EF;
  color: var(--adm-green);
}
.np_adm_badge.published {
  background: #E6F6EF;
  color: var(--adm-green);
}
.np_adm_badge.draft {
  background: var(--adm-blue-soft);
  color: var(--adm-blue);
}

.np_adm_note {
  color: var(--adm-muted);
  font-size: 13px;
}
.np_adm code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--adm-blue-soft);
  color: var(--adm-blue);
  font-size: 12px;
}
.np_adm_error {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 9px;
  background: #FDECEA;
  color: var(--adm-red);
  font-size: 14px;
}
.np_adm_empty {
  padding: 30px;
  text-align: center;
  color: var(--adm-muted);
}

/* ── Bar chart (weekly leads) ────────────────────────────────── */
.np_adm_bars {
  display: flex;
  align-items: stretch;
  gap: 8px;
  height: 170px;
  margin-top: 6px;
}
.np_adm_bar {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--adm-muted);
}
/* The browser's own tooltip takes about a second to appear and cannot hold two
   lines, so the numbers ride in data-tip and show the moment the bar is hovered. */
.np_adm_bar[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, -6px);
  z-index: 4;
  padding: 7px 10px;
  border-radius: 8px;
  background: #07173F;
  color: #FFFFFF;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-line;
  text-align: center;
  min-width: 96px;
  box-shadow: 0 10px 24px -12px rgba(2, 10, 30, 0.9);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}
.np_adm_bar:hover[data-tip]::after {
  opacity: 1;
  visibility: visible;
}
/* Something has to react under the pointer, or the chart reads as flat. */
.np_adm_bar:hover i {
  filter: brightness(1.12);
}
.np_adm_bar:hover .np_adm_bar_track {
  background: var(--adm-blue-soft);
  border-radius: 6px;
}
/* The fill is sized against this track, not the whole column — otherwise a
   100% bar is as tall as the chart *plus* its label and spills out the top. */
.np_adm_bar_track {
  flex: 1;
  display: flex;
  align-items: flex-end;
  width: 100%;
}
.np_adm_bar i {
  display: block;
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #3FA9FF 0%, #2B6CF0 100%);
  min-height: 3px;
}
.np_adm_bar em {
  font-style: normal;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Past ~20 columns the labels collide into an unreadable smear; the hover
   tooltip on each bar still names the day. */
.np_adm_bars.dense {
  gap: 3px;
}
.np_adm_bars.dense .np_adm_bar em {
  display: none;
}

/* ── Share list (sources, devices…) ──────────────────────────── */
.np_adm_share {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.np_adm_share li {
  font-size: 14px;
}
.np_adm_share .np_adm_share_top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}
.np_adm_share .np_adm_share_top span:first-child {
  cursor: help;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.np_adm_share .np_adm_share_top span:last-child {
  flex-shrink: 0;
  color: var(--adm-muted);
  font-size: 13px;
}
.np_adm_share_track {
  height: 6px;
  border-radius: 6px;
  background: var(--adm-blue-soft);
  overflow: hidden;
}
.np_adm_share_track i {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #2B6CF0 0%, #3FA9FF 100%);
}

/* ── Login ───────────────────────────────────────────────────── */
.np_adm_login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(90% 70% at 50% 0%, #0D2366 0%, #061233 70%);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
.np_adm_login_card {
  width: min(380px, 100%);
  background: #FFFFFF;
  border-radius: 16px;
  padding: 32px 30px;
  box-shadow: 0 30px 60px -30px rgba(2, 10, 30, 0.8);
  color: #0B2154;
}
.np_adm_login_card img {
  height: 38px;
  width: auto;
  margin-bottom: 18px;
}
.np_adm_login_card h1 {
  margin: 0 0 6px;
  font-size: 22px;
}
.np_adm_login_card p {
  margin: 0 0 22px;
  color: #5B6B8C;
  font-size: 14px;
}

/* ── Blog editor ─────────────────────────────────────────────── */
.np_adm_block {
  border: 1px solid var(--adm-line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #FBFCFF;
}
.np_adm_block_head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.np_adm_block_head select {
  width: auto;
  min-width: 150px;
}
.np_adm_block_head .np_adm_spacer {
  margin-left: auto;
}
/* In-paragraph links: phrase + href, matched against the paragraph on render. */
.np_adm_links {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--adm-line);
}
.np_adm_error.small {
  display: block;
  margin: 6px 0 0;
  padding: 6px 10px;
  font-size: 12px;
}
.np_adm_cover {
  display: block;
  max-width: 260px;
  border-radius: 10px;
  border: 1px solid var(--adm-line);
  margin-top: 10px;
}

@media (max-width: 991px) {
  .np_adm {
    grid-template-columns: 1fr;
  }
  .np_adm_side {
    position: sticky;
    top: 0;
    z-index: 5;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    overflow-x: auto;
    padding: 14px 16px;
  }
  .np_adm_nav {
    flex-direction: row;
  }
  .np_adm_side_foot {
    margin: 0 0 0 auto;
  }
  .np_adm_main {
    padding: 20px 16px 50px;
  }
  .np_adm_grid.cols_4,
  .np_adm_grid.cols_3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .np_adm_grid.cols_2 {
    grid-template-columns: minmax(0, 1fr);
  }
  /* The sidebar is a strip now, so its footer sits inline with the nav. */
  .np_adm_side_foot {
    flex-direction: row;
    align-items: center;
  }
}
@media (max-width: 575px) {
  .np_adm_grid.cols_4,
  .np_adm_grid.cols_3,
  .np_adm_grid.cols_2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── Responsive pass (admin tabs) ───────────────────────────── */
/* Long free-text cells (lead messages) are clamped; "Show more" opens one. */
.np_adm_msg {
  max-width: 420px;
  min-width: 240px;
}
.np_adm_clamp {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.np_adm_linkbtn {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--adm-blue);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.np_adm_linkbtn:hover {
  text-decoration: underline;
}
@media (max-width: 991px) {
  /* The sidebar is a strip: keep every item on one line and let the strip
     scroll sideways instead of wrapping labels onto two lines. */
  .np_adm_nav {
    gap: 2px;
    flex: 0 0 auto;
  }
  .np_adm_nav a {
    white-space: nowrap;
    padding: 8px 10px;
    font-size: 14px;
  }
  .np_adm_brand img {
    height: 28px;
  }
  .np_adm_side_foot {
    gap: 8px;
    white-space: nowrap;
  }
  .np_adm_head h1 {
    font-size: 22px;
  }
  .np_adm_card {
    padding: 16px;
  }
}
@media (max-width: 575px) {
  .np_adm_main {
    padding: 16px 12px 40px;
  }
  .np_adm_head {
    gap: 12px;
    margin-bottom: 18px;
  }
  .np_adm_head h1 {
    font-size: 20px;
  }
  /* Toolbar buttons (filters, export) wrap into tidy rows; an "Export" pushed
     to the far right by margin:auto drops under the filters instead. */
  .np_adm_row > .np_adm_btn[style*="margin-left: auto"],
  .np_adm_row > .np_adm_btn[style*="margin-left:auto"] {
    margin-left: 0 !important;
  }
  .np_adm_side {
    padding: 10px 12px;
  }
  .np_adm_side_foot a[target="_blank"] {
    display: none;
  }
  .np_adm_table th,
  .np_adm_table td {
    padding: 10px 10px;
  }
  .np_adm_scroll > .np_adm_table {
    min-width: 720px;
  }
}
/* Grid and flex children default to min-width:auto, which lets a wide table
   push the whole page sideways instead of scrolling inside its card. */
.np_adm_grid > *,
.np_adm_card,
.np_adm_scroll {
  min-width: 0;
  max-width: 100%;
}
.np_adm_flush {
  overflow-x: auto;
}
/* Hover tooltips on the bar charts are absolutely positioned and can poke past
   the right edge on narrow screens; the column clips them instead of letting
   the whole page scroll sideways. Cards keep their own horizontal scroll. */
.np_adm_main {
  overflow-x: hidden;
}
/* On short pages the grid stretched both rows to fill the viewport, leaving a
   band of empty space under the nav strip; only the main row may grow. */
@media (max-width: 991px) {
  .np_adm {
    grid-template-rows: auto 1fr;
  }
}
/* Activity timeline badges (Admin → Demo leads → person) */
.np_adm_badge.act_view { background: var(--adm-blue-soft); color: var(--adm-blue); }
.np_adm_badge.act_click { background: #E6F6EF; color: var(--adm-green); }
.np_adm_badge.act_submit { background: #FDF3E2; color: var(--adm-amber); }
.np_adm_badge.act_api { background: #EFE9FD; color: #5B3FD6; }
.np_adm_badge.act_ping { background: #EEF1F6; color: var(--adm-muted); }
