:root {
  --np-purple: #5b3a8c;
  --np-purple-2: #7b5aaf;
  --np-pink: #e891b8;
  --np-ink: #241833;
  --np-mute: #6e6280;
  --np-line: #e4d9ef;
  --np-bg: #f5f1f9;
  --np-sidebar: #2a1845;
  --np-card: #ffffff;
  --np-ok: #2f9e6b;
  --np-warn: #d97706;
  --np-danger: #b23a3a;
  --np-water: #4ba3c7;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.np-admin {
  margin: 0;
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: var(--np-ink);
  background: var(--np-bg);
}

a { color: var(--np-purple); text-decoration: none; }
a:hover { color: var(--np-purple-2); }

.np-shell { display: flex; min-height: 100vh; }

.np-mobile-bar { display: none; }
.np-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 35, .45);
  z-index: 45;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}
.np-sidebar__close { display: none; }

.np-sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--np-sidebar), #3d2460 55%, #4a2d6e);
  color: #fff;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 40;
}

.np-sidebar__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.np-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 22px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 16px;
  flex: 1;
}
.np-brand__mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--np-pink), var(--np-purple-2));
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
}
.np-brand__name { font-family: Fraunces, Georgia, serif; font-size: 1.25rem; font-weight: 700; }
.np-brand__sub { font-size: .75rem; opacity: .7; }

.np-nav { list-style: none; margin: 0; padding: 0; }
.np-nav a {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.82);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: .92rem;
}
.np-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.np-nav a.active { background: rgba(232,145,184,.22); color: #fff; }
.np-nav i { width: 18px; text-align: center; opacity: .9; }

.np-sidebar__foot {
  margin-top: 24px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  font-size: .78rem;
  line-height: 1.4;
  opacity: .85;
}

.np-main { flex: 1; min-width: 0; padding: 22px 28px 40px; }

.np-topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 22px;
}
.np-topbar h1 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.85rem;
  font-weight: 700;
}
.np-topbar p { margin: 6px 0 0; color: var(--np-mute); }
.np-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--np-line);
  border-radius: 999px; padding: 8px 14px;
  font-size: .85rem; color: var(--np-mute); font-weight: 600;
}

.np-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.np-kpi {
  background: var(--np-card);
  border: 1px solid var(--np-line);
  border-radius: 16px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.np-kpi::after {
  content: "";
  position: absolute; left: 0; bottom: 0; height: 4px; width: 100%;
  background: linear-gradient(90deg, var(--np-purple), var(--np-pink));
}
.np-kpi--warn::after { background: var(--np-warn); }
.np-kpi--ok::after { background: var(--np-ok); }
.np-kpi--water::after { background: var(--np-water); }
.np-kpi__label { color: var(--np-mute); font-size: .82rem; font-weight: 600; }
.np-kpi__value {
  display: block; margin-top: 6px;
  font-size: 1.8rem; font-weight: 800; letter-spacing: -0.03em;
}
.np-kpi__hint { font-size: .78rem; color: var(--np-mute); }

.np-grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.np-card {
  background: var(--np-card);
  border: 1px solid var(--np-line);
  border-radius: 16px;
  padding: 16px 18px;
}
.np-card__head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.np-card__head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-family: Fraunces, Georgia, serif;
}
.np-badge {
  font-size: .72rem; font-weight: 700;
  background: #efe6f8; color: var(--np-purple);
  border-radius: 999px; padding: 4px 10px;
}
.np-badge--ok { background: #e5f6ee; color: var(--np-ok); }
.np-badge--warn { background: #fff4e5; color: var(--np-warn); }
.np-badge--danger { background: #fde8e8; color: var(--np-danger); }
.np-badge--mute { background: #eee; color: #666; }

.np-table-wrap { overflow-x: auto; }
table.np-table {
  width: 100%; border-collapse: collapse; font-size: .9rem;
}
.np-table th {
  text-align: left; color: var(--np-mute); font-weight: 700;
  font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 8px; border-bottom: 1px solid var(--np-line);
}
.np-table td {
  padding: 12px 8px; border-bottom: 1px solid #f0eaf6;
  vertical-align: middle;
}
.np-table tr:hover td { background: #faf7fc; }

.np-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.np-btn {
  border: none; cursor: pointer;
  border-radius: 10px; padding: 9px 14px;
  font-weight: 700; font-size: .85rem;
  background: var(--np-purple); color: #fff;
}
.np-btn:hover { background: var(--np-purple-2); }
.np-btn--ghost {
  background: #fff; color: var(--np-purple);
  border: 1px solid var(--np-line);
}
.np-btn--sm { padding: 6px 10px; font-size: .78rem; }

.np-hero {
  background: linear-gradient(135deg, var(--np-purple), var(--np-purple-2) 55%, #c97aa8);
  color: #fff;
  border-radius: 20px;
  padding: 22px 24px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
.np-hero h2 {
  margin: 0 0 8px;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.6rem;
}
.np-hero p { margin: 0; opacity: .9; line-height: 1.45; }
.np-hero__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.np-hero__chip {
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .8rem; font-weight: 700;
}
.np-ai-box {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px;
  padding: 14px;
}
.np-ai-box h4 { margin: 0 0 10px; font-size: .78rem; letter-spacing: .06em; opacity: .85; }
.np-ai-item {
  background: rgba(0,0,0,.12);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: .85rem;
  line-height: 1.35;
}
.np-ai-item:last-child { margin-bottom: 0; }

.np-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.np-field label {
  display: block; font-size: .8rem; font-weight: 700;
  color: var(--np-mute); margin-bottom: 6px;
}
.np-field input, .np-field select, .np-field textarea {
  width: 100%;
  border: 1px solid var(--np-line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
.np-field textarea { min-height: 90px; resize: vertical; }

.np-alert-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.np-alert-card {
  background: #fff;
  border: 1px solid var(--np-line);
  border-left: 4px solid var(--np-danger);
  border-radius: 12px;
  padding: 14px;
}
.np-alert-card.ok { border-left-color: var(--np-ok); }
.np-alert-card h4 { margin: 0 0 4px; font-size: .95rem; }
.np-alert-card p { margin: 0; color: var(--np-mute); font-size: .85rem; }

.chart-box { height: 260px; position: relative; }

/* —— Tablet —— */
@media (max-width: 1100px) {
  .np-kpi-grid { grid-template-columns: 1fr 1fr; }
  .np-grid-2, .np-hero, .np-alert-row, .np-form-grid { grid-template-columns: 1fr; }
  .np-main { padding: 18px 16px 32px; }
}

/* —— Mobile / drawer —— */
@media (max-width: 900px) {
  body.np-menu-open { overflow: hidden; }

  .np-mobile-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 30;
    background: linear-gradient(90deg, var(--np-sidebar), #3d2460);
    color: #fff;
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    border-bottom: 1px solid rgba(255,255,255,.1);
  }
  .np-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 42px; height: 42px;
    padding: 0 12px;
    border: 0; border-radius: 12px;
    background: rgba(255,255,255,.18);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    z-index: 60;
    position: relative;
  }
  .np-menu-btn__txt { font-size: .8rem; }
  .np-mobile-bar__brand {
    display: flex; align-items: center; gap: 8px;
    font-weight: 700; font-size: .95rem; flex: 1;
  }
  .np-mobile-bar__mark {
    width: 28px; height: 28px; border-radius: 8px;
    background: linear-gradient(135deg, var(--np-pink), var(--np-purple-2));
    display: grid; place-items: center;
    font-size: .85rem; font-weight: 800;
  }
  .np-mobile-bar__tag {
    font-size: .7rem; font-weight: 700;
    background: rgba(232,145,184,.25);
    border-radius: 999px;
    padding: 4px 10px;
  }

  body.np-drawer-open .np-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .np-sidebar {
    position: fixed !important;
    left: 0; top: 0; bottom: 0;
    width: min(300px, 86vw);
    height: 100% !important;
    max-height: 100%;
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 50;
    box-shadow: none;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  body.np-drawer-open .np-sidebar,
  .np-sidebar.is-open {
    transform: translateX(0) !important;
    box-shadow: 8px 0 32px rgba(0,0,0,.28);
  }

  .np-sidebar__close {
    display: grid;
    place-items: center;
    width: 36px; height: 36px;
    margin-top: 6px;
    border: 0; border-radius: 10px;
    background: rgba(255,255,255,.12);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
  }

  .np-brand {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 12px;
  }
  .np-sidebar__top {
    border-bottom: 1px solid rgba(255,255,255,.12);
    margin-bottom: 14px;
    padding-bottom: 4px;
  }

  .np-nav a {
    padding: 12px 14px;
    font-size: .95rem;
    min-height: 44px;
  }

  .np-main {
    width: 100%;
    padding: 14px 12px 28px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }

  .np-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }
  .np-topbar h1 { font-size: 1.45rem; }
  .np-topbar .np-btn,
  .np-topbar .np-pill { width: 100%; justify-content: center; text-align: center; }

  .np-kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .np-kpi { padding: 12px 14px; }
  .np-kpi__value { font-size: 1.45rem; }

  .np-hero { padding: 16px; border-radius: 16px; }
  .np-hero h2 { font-size: 1.25rem; }
  .np-hero__chips { gap: 6px; }
  .np-hero__chip { font-size: .72rem; }

  .chart-box { height: 220px; }

  .np-card { padding: 12px 12px; border-radius: 14px; }
  .np-table { font-size: .82rem; }
  .np-table th, .np-table td { padding: 10px 6px; white-space: nowrap; }
  .np-table td:first-child,
  .np-table th:first-child { position: sticky; left: 0; background: #fff; z-index: 1; }
  .np-table-wrap {
    margin: 0 -4px;
    padding: 0 4px;
    -webkit-overflow-scrolling: touch;
  }

  .np-actions { flex-wrap: nowrap; }
  .np-btn { min-height: 42px; }
  .np-btn--sm { min-height: 34px; }

  .np-alert-row { gap: 10px; }
  .np-sidebar__foot { font-size: .72rem; }
}

@media (max-width: 480px) {
  .np-kpi-grid { grid-template-columns: 1fr; }
  .np-kpi__value { font-size: 1.6rem; }
}
