/* NMTree admin refresh — dashboard, template picker and light global polish.
   Loaded after the Stisla theme CSS in includes/head.php. */

:root {
  --nm-ink: #0f172a;
  --nm-muted: #64748b;
  --nm-line: #e8ecf3;
  --nm-surface: #ffffff;
  --nm-bg: #f5f7fb;
  --nm-radius: 18px;
  --nm-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
}

/* ---------- global polish ---------- */
body { background: var(--nm-bg); }
.main-content .card {
  border-radius: var(--nm-radius);
  box-shadow: var(--nm-shadow);
  border: 1px solid var(--nm-line);
}
.main-content .card .card-header { border-bottom-color: var(--nm-line); }
.main-content .card .card-footer { border-radius: 0 0 var(--nm-radius) var(--nm-radius); }
.section .section-header {
  border-radius: var(--nm-radius);
  box-shadow: var(--nm-shadow);
  border: 1px solid var(--nm-line);
}
.btn { border-radius: 10px; }
.form-control, .selectgroup-button { border-radius: 10px !important; }
.main-sidebar .sidebar-menu li.active > a { border-radius: 0 12px 12px 0; }

/* ---------- dashboard ---------- */
.nm-dash .section { padding-top: 6px; }
.nm-alert {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
  border-radius: var(--nm-radius);
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  box-shadow: var(--nm-shadow);
}
.nm-alert > i { font-size: 20px; }

.nm-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 30px 32px;
  margin-bottom: 22px;
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(600px 300px at 90% 0%, rgba(236, 72, 153, .55), transparent 60%),
    radial-gradient(500px 300px at 60% 120%, rgba(14, 165, 233, .45), transparent 60%),
    linear-gradient(135deg, #312e81, #4f46e5 55%, #7c3aed);
  box-shadow: 0 20px 40px -20px rgba(79, 70, 229, .65);
}
.nm-hero-text { position: relative; z-index: 1; max-width: 680px; }
.nm-eyebrow {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .8;
}
.nm-hero h1 {
  font-size: 30px;
  font-weight: 800;
  margin: 0 0 14px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nm-hero-sub { opacity: .85; font-size: 15px; margin-bottom: 18px; }
.nm-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, .7);
  animation: nm-pulse 1.8s infinite;
}
@keyframes nm-pulse {
  70% { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}
.nm-url {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 560px;
  padding: 6px 6px 6px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .25);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.nm-url-text {
  flex: 1;
  min-width: 0;
  color: #fff !important;
  font-weight: 700;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nm-url-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  background: #fff;
  color: #4338ca !important;
  font-weight: 700;
  text-decoration: none !important;
}
.nm-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.nm-hero-actions .btn { font-weight: 700; padding: 8px 14px; }
.nm-hero-actions .btn-light { color: #4338ca; }
.nm-hero .btn-ghost {
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22);
}
.nm-hero .btn-ghost:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.nm-hero-art { position: absolute; right: 24px; top: 0; bottom: 0; width: 260px; }
.nm-hero-art span {
  position: absolute;
  right: 0;
  width: 190px;
  height: 46px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .25);
  transform: rotate(-12deg);
}
.nm-hero-art span:nth-child(1) { top: 26%; right: 40px; }
.nm-hero-art span:nth-child(2) { top: 46%; right: 10px; background: rgba(255, 255, 255, .26); }
.nm-hero-art span:nth-child(3) { top: 66%; right: 56px; }

.nm-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.nm-stat {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-radius: var(--nm-radius);
  background: var(--nm-surface);
  border: 1px solid var(--nm-line);
  box-shadow: var(--nm-shadow);
}
.nm-stat-icon {
  flex: 0 0 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
}
.nm-stat small { display: block; color: var(--nm-muted); font-weight: 600; font-size: 12.5px; }
.nm-stat strong { display: block; font-size: 26px; line-height: 1.2; color: var(--nm-ink); font-weight: 800; }
.nm-stat em { font-style: normal; font-size: 12px; color: #10b981; font-weight: 600; }

.nm-card { padding: 20px; margin-bottom: 22px; }
.nm-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.nm-card-head h4 { margin: 0; font-size: 16px; font-weight: 800; color: var(--nm-ink); }
.nm-card-head a { font-weight: 700; font-size: 13px; }
.nm-chart { position: relative; height: 260px; }
.nm-empty-note { margin: 10px 0 0; color: var(--nm-muted); font-size: 13px; }

.nm-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.nm-links li { display: flex; gap: 12px; align-items: center; }
.nm-link-icon {
  flex: 0 0 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--c);
}
.nm-link-body { flex: 1; min-width: 0; }
.nm-link-row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.nm-link-title { font-weight: 700; color: var(--nm-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm-bar { height: 6px; border-radius: 6px; background: #eef2f7; overflow: hidden; }
.nm-bar span { display: block; height: 100%; border-radius: 6px; background: var(--c); }

.nm-empty { text-align: center; padding: 18px 8px; color: var(--nm-muted); }
.nm-empty > i { font-size: 26px; color: #c7d2fe; margin-bottom: 8px; }

.nm-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.nm-actions a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 6px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--nm-line);
  color: var(--nm-ink);
  font-weight: 700;
  font-size: 12.5px;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.nm-actions a:hover { transform: translateY(-2px); box-shadow: var(--nm-shadow); color: var(--nm-ink); }
.nm-actions i {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  font-size: 16px;
}

.nm-phone {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 9 / 18.5;
  margin: 0 auto;
  border-radius: 40px;
  padding: 12px;
  background: #0f172a;
  box-shadow: 0 30px 50px -25px rgba(15, 23, 42, .6), inset 0 0 0 2px #334155;
}
.nm-phone iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 30px;
  background: #fff;
}
.nm-phone-notch {
  position: absolute;
  top: 18px;
  left: 50%;
  width: 90px;
  height: 22px;
  border-radius: 20px;
  background: #0f172a;
  transform: translateX(-50%);
  z-index: 1;
}

.nm-plan-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.nm-plan-top a { font-weight: 700; }
.nm-plan-badge {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  color: #92400e;
  background: #fef3c7;
}
.nm-plan-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--nm-line); }
.nm-plan-row span { color: var(--nm-muted); }
.nm-plan-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.nm-plan-counts a {
  text-align: center;
  padding: 10px 4px;
  border-radius: 12px;
  background: #f8fafc;
  text-decoration: none;
}
.nm-plan-counts strong { display: block; font-size: 18px; color: var(--nm-ink); }
.nm-plan-counts small { color: var(--nm-muted); font-weight: 600; }

@media (max-width: 1199px) {
  .nm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .nm-hero { padding: 24px 20px; }
  .nm-hero h1 { font-size: 24px; }
  .nm-hero-art { display: none; }
  .nm-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .nm-stat { flex-direction: column; align-items: flex-start; padding: 14px; }
  .nm-url-btn span { display: none; }
}

/* ---------- template picker (card-theme.php) ---------- */
.nm-step {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 16px;
  font-weight: 800;
  color: var(--nm-ink);
}
.nm-step > span {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: #fff;
  background: var(--theme-color, #6366f1);
}
.nm-step small { font-weight: 600; }
.nm-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}
.nm-theme {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  margin: 0;
  border-radius: 20px;
  border: 2px solid var(--nm-line);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.nm-theme:hover { transform: translateY(-2px); box-shadow: var(--nm-shadow); }
.nm-theme input { position: absolute; opacity: 0; pointer-events: none; }
.nm-theme.is-current, .nm-theme:has(input:checked) {
  border-color: var(--theme-color, #6366f1);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--theme-color, #6366f1) 18%, transparent);
}
.nm-theme.is-current::after, .nm-theme:has(input:checked)::after {
  content: "\f00c";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  position: absolute;
  top: 18px;
  right: 18px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #fff;
  background: var(--theme-color, #6366f1);
  z-index: 2;
}
.nm-theme-phone {
  position: relative;
  display: block;
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  background: #f1f5f9;
}
.nm-theme-phone img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.nm-theme-phone iframe {
  /* render at phone width, then scale down into the thumbnail */
  width: 400%;
  height: 400%;
  border: 0;
  transform: scale(.25);
  transform-origin: 0 0;
  pointer-events: none;
}
.nm-theme-phone em {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
}
.nm-theme-meta strong { display: block; color: var(--nm-ink); font-size: 14px; }
.nm-theme-meta small { color: var(--nm-muted); line-height: 1.35; display: block; }
.nm-theme-preview { font-size: 12px; font-weight: 700; }

.nm-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 22px; }
.nm-preset {
  border: 0;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35);
  transition: transform .15s;
}
.nm-preset:hover { transform: translateY(-2px); }
.nm-preset.active { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--nm-ink); }
.nm-preset span { text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }

/* ---------- Smart Cards list (views/cards.php) ---------- */
.nm-list-toolbar { display: flex; gap: 12px; margin-bottom: 8px; }
.nm-search { position: relative; flex: 1; }
.nm-search i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--nm-muted); }
.nm-search input, .nm-sort {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--nm-line);
  background: #fff;
  font-size: 15px;
  color: var(--nm-ink);
  box-shadow: var(--nm-shadow);
}
.nm-search input { padding: 0 16px 0 44px; }
.nm-search input:focus, .nm-sort:focus { outline: 0; border-color: var(--theme-color, #6366f1); }
.nm-sort { width: auto; padding: 0 14px; font-weight: 600; cursor: pointer; }
.nm-list-count { margin: 6px 4px 14px; color: var(--nm-muted); font-size: 13px; font-weight: 600; min-height: 18px; }

.nm-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  transition: opacity .2s;
}
.nm-card-grid.is-loading { opacity: .5; pointer-events: none; }
.nm-pcard {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--nm-line);
  box-shadow: var(--nm-shadow);
  min-width: 0;
  transition: transform .15s ease, box-shadow .15s ease;
}
.nm-pcard:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 20px 40px -18px rgba(15, 23, 42, .3); }
.nm-skeleton { min-height: 260px; background: linear-gradient(90deg, #f1f5f9 25%, #f8fafc 50%, #f1f5f9 75%); background-size: 200% 100%; animation: nm-shimmer 1.2s infinite; }
@keyframes nm-shimmer { to { background-position: -200% 0; } }

.nm-pcard-top { position: relative; display: flex; gap: 14px; align-items: center; min-width: 0; }
.nm-pcard-photo {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  background: #f1f5f9;
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--nm-line);
}
.nm-pcard-id { min-width: 0; flex: 1; padding-right: 64px; }
.nm-pcard-id h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--nm-ink);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nm-pcard-sub { margin: 2px 0 0; color: var(--theme-color, #6366f1); font-weight: 700; font-size: 13px; line-height: 1.3; }
.nm-pcard-link {
  display: inline-block;
  max-width: 100%;
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--nm-muted) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nm-pcard-tag {
  position: absolute;
  top: 0;
  right: 0;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #4338ca;
  background: #eef2ff;
}
.nm-pcard-desc {
  margin: 0;
  color: var(--nm-muted);
  font-size: 13.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nm-pcard-owner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8fafc;
  min-width: 0;
}
.nm-pcard-owner img, .nm-pcard-owner > span {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.nm-pcard-owner > span {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  background: var(--theme-color, #6366f1);
}
.nm-pcard-owner > div { min-width: 0; }
.nm-pcard-owner strong, .nm-pcard-owner small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nm-pcard-owner strong { font-size: 13.5px; color: var(--nm-ink); }
.nm-pcard-owner small { color: var(--nm-muted); font-size: 12px; }

.nm-pcard-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px dashed var(--nm-line); padding-top: 12px; }
.nm-pcard-stats div { text-align: center; }
.nm-pcard-stats div + div { border-left: 1px solid var(--nm-line); }
.nm-pcard-stats strong { display: block; font-size: 17px; color: var(--nm-ink); line-height: 1.2; }
.nm-pcard-stats small { color: var(--nm-muted); font-size: 11.5px; font-weight: 600; }

.nm-pcard-actions { display: flex; gap: 8px; margin-top: auto; }
.nm-act {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
  color: var(--nm-ink) !important;
  background: #f1f5f9;
  text-decoration: none !important;
  transition: background .15s;
  white-space: nowrap;
}
.nm-act:hover { background: #e2e8f0; }
.nm-act-primary { color: #fff !important; background: var(--theme-color, #6366f1); }
.nm-act-primary:hover { background: var(--theme-color, #6366f1); filter: brightness(.92); }
.nm-act-danger { flex: 0 0 38px; color: #dc2626 !important; background: #fef2f2; }
.nm-act-danger:hover { background: #fee2e2; }

.nm-list-empty { grid-column: 1 / -1; text-align: center; padding: 50px 20px; color: var(--nm-muted); background: #fff; border-radius: 20px; border: 1px dashed var(--nm-line); }
.nm-list-empty i { font-size: 34px; color: #cbd5e1; margin-bottom: 10px; }

.nm-pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 22px 0 6px; }
.nm-pager button, .nm-pager span {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid var(--nm-line);
  background: #fff;
  font-weight: 700;
  color: var(--nm-ink);
}
.nm-pager span { border: 0; background: none; display: grid; place-items: center; }
.nm-pager button.active { color: #fff; background: var(--theme-color, #6366f1); border-color: transparent; }
.nm-pager button:disabled { opacity: .4; }

@media (max-width: 575px) {
  .nm-list-toolbar { flex-direction: column; gap: 10px; }
  .nm-sort { width: 100%; }
  .nm-card-grid { grid-template-columns: 1fr; gap: 14px; }
  .nm-act span { display: none; }
  .nm-act { height: 42px; font-size: 15px; }
}
/* many actions: icon-only buttons except the main Edit button, so the row never overflows */
.nm-pcard-actions:has(> :nth-child(4)) .nm-act:not(.nm-act-primary) { flex: 0 0 40px; padding: 0; }
.nm-pcard-actions:has(> :nth-child(4)) .nm-act:not(.nm-act-primary) span { display: none; }
@media (max-width: 575px) {
  .nm-act span { display: inline; }
  .nm-pcard-actions:has(> :nth-child(4)) .nm-act:not(.nm-act-primary) { flex: 0 0 44px; }
}
