:root {
  --bg: #07141a;
  --bg2: #0c222c;
  --card: rgba(255, 255, 255, 0.96);
  --ink: #10212a;
  --muted: #5d7380;
  --line: #d5e2e8;
  --accent: #00c2b8;
  --accent2: #12e0b8;
  --accent-deep: #067f7a;
  --warn: #e24c4c;
  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
a { color: var(--accent-deep); }
code, .npc-secret { font-family: "JetBrains Mono", ui-monospace, monospace; }

.npc-auth {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(18, 224, 184, 0.35), transparent 55%),
    radial-gradient(900px 420px at 90% 10%, rgba(0, 140, 255, 0.22), transparent 50%),
    linear-gradient(160deg, var(--bg), var(--bg2) 55%, #0a1a22);
}

.npc-auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(16px, var(--safe-top)) 16px max(24px, var(--safe-bottom));
}

.npc-auth-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: calc(var(--radius) + 4px);
  padding: 24px 20px 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.npc-auth-card--wide { width: min(720px, 100%); }

.npc-brand {
  margin: 0 0 8px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent-deep);
  text-transform: uppercase;
  font-size: 12px;
}

.npc-auth-title { margin: 0; font-size: clamp(22px, 5vw, 28px); line-height: 1.15; font-weight: 800; }
.npc-auth-sub { margin: 8px 0 18px; color: var(--muted); }

.npc-form { display: grid; gap: 8px; }
.npc-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.npc-input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px; /* iOS: avoid zoom on focus */
  outline: none;
  background: #fff;
  width: 100%;
  max-width: 100%;
}
.npc-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 194, 184, 0.2); }
select.npc-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px); background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 36px; }

.npc-btn {
  display: inline-flex; justify-content: center; align-items: center;
  border: 0; border-radius: 999px; padding: 12px 18px;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  margin-top: 8px;
  min-height: 44px;
  touch-action: manipulation;
}
.npc-btn--primary {
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  color: #042526;
}
.npc-btn--primary:hover { filter: brightness(1.03); }
.npc-btn--ghost {
  background: transparent; border: 1px solid var(--line); color: var(--ink);
}

.npc-error {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 10px;
  background: #ffe8e8; color: var(--warn); font-weight: 600;
}
.npc-hint { margin: 16px 0 0; color: var(--muted); font-size: 13px; }

.npc-check {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 14px; color: var(--muted); margin-top: 4px;
}
.npc-check input { margin-top: 3px; min-width: 18px; min-height: 18px; }

.npc-2fa {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}
.npc-qr {
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 8px;
  max-width: 220px;
  width: 100%;
  height: auto;
}
.npc-secret {
  display: block;
  word-break: break-all;
  background: #f3f8fa;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

.npc-app {
  min-height: 100vh;
  min-height: 100dvh;
  background: #f4f7f8;
  padding-bottom: var(--safe-bottom);
}

.npc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: max(10px, var(--safe-top)) clamp(12px, 3vw, 32px) 12px;
  background: #07141a;
  color: #e8fffb;
  position: sticky;
  top: 0;
  z-index: 40;
}

.npc-top__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.npc-top__brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.npc-top__brand strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.npc-top__brand p { margin: 2px 0 0; color: #8eb5b1; font-size: 13px; }
.npc-top__mark {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #042526;
}
.npc-top__user { display: flex; gap: 14px; align-items: center; color: #9ec4bf; font-size: 14px; flex-shrink: 0; }
.npc-top__user a { color: var(--accent2); text-decoration: none; font-weight: 700; }
.npc-top__user--nav { display: none; }

.npc-nav-toggle {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid rgba(158, 196, 191, 0.35);
  border-radius: 12px;
  background: transparent;
  padding: 10px;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  flex-shrink: 0;
}
.npc-nav-toggle span {
  display: block;
  height: 2px;
  background: #e8fffb;
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
body.npc-nav-open .npc-nav-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
body.npc-nav-open .npc-nav-toggle span:nth-child(2) { opacity: 0; }
body.npc-nav-open .npc-nav-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.npc-nav { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.npc-nav a {
  color: #9ec4bf;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 4px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.npc-nav a.is-active, .npc-nav a:hover { color: var(--accent2); }

.npc-main {
  padding: 24px clamp(12px, 3vw, 32px) 40px;
  max-width: 1180px;
  margin: 0 auto;
}
.npc-main h1 { margin: 0 0 8px; font-size: clamp(24px, 5vw, 32px); font-weight: 800; }
.npc-lead { margin: 0 0 24px; color: var(--muted); }
.npc-eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 13px; word-break: break-word; }
.npc-muted { color: var(--muted); }
.npc-warn { color: #c0392b; font-size: 13px; font-weight: 600; }

.npc-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.npc-head__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.npc-head .npc-btn { margin-top: 0; width: auto; }

.npc-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.npc-kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.npc-kpi span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.npc-kpi strong { font-size: 24px; }
.npc-kpi--warn { border-color: #f0b4b4; background: #fff7f7; }

.npc-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.npc-cols--2 { grid-template-columns: 1.4fr 1fr; }
.npc-stack { display: grid; gap: 14px; }

.npc-panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.npc-panel--ok { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: #f3fffc; }
.npc-panel h2 { margin: 0 0 10px; font-size: 18px; }
.npc-panel__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.npc-panel__head h2 { margin: 0; }
.npc-panel__head a { font-size: 13px; font-weight: 700; }

.npc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.npc-list li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid #eef3f5; }
.npc-list li:last-child { border-bottom: 0; }
.npc-list--cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); display: grid; }
.npc-list--cards li { border: 0; display: grid; gap: 10px; }

.npc-tag {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 10px;
  background: #e8f4f2; color: var(--accent-deep); font-size: 12px; font-weight: 700;
}
.npc-tag--lg { font-size: 14px; padding: 6px 12px; }
.npc-tag--active { background: #e5f8f0; color: #0b6b45; }
.npc-tag--invited { background: #fff4e0; color: #9a5b00; }
.npc-tag--disabled { background: #eee; color: #666; }
.npc-tag--inv-active { background: #e5f8f0; color: #0b6b45; }
.npc-tag--inv-pending { background: #e8f1ff; color: #1a4f9c; }
.npc-tag--inv-expired { background: #ffe8e8; color: #a32020; }
.npc-tag--inv-disabled { background: #eee; color: #666; }
.npc-tag--inv-no_2fa { background: #fff4e0; color: #9a5b00; }

.npc-cardlist { display: none; list-style: none; margin: 0; padding: 0; gap: 10px; }
.npc-cardlist li {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 8px;
}
.npc-cardlist a { text-decoration: none; color: var(--ink); }
.npc-cardlist__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }

.npc-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.npc-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  min-width: 520px;
}
.npc-table th, .npc-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
.npc-table th { background: #f7fbfb; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.npc-table tr:last-child td { border-bottom: 0; }

.npc-form--wide { max-width: 720px; width: 100%; }
.npc-form--inline { display: flex; gap: 10px; max-width: 560px; margin-bottom: 16px; flex-wrap: wrap; }
.npc-form--inline .npc-input { flex: 1; margin: 0; min-width: 160px; }
.npc-form--inline .npc-btn { margin: 0; }
.npc-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.npc-checks { display: grid; gap: 6px; margin: 8px 0; }
.npc-filters { margin-bottom: 14px; max-width: 280px; width: 100%; }
textarea.npc-input { resize: vertical; min-height: 96px; }

.npc-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: -8px 0 18px; color: var(--muted); font-size: 14px; }
.npc-feed { display: grid; gap: 10px; margin-bottom: 14px; max-height: min(480px, 55vh); overflow: auto; -webkit-overflow-scrolling: touch; }
.npc-feed__item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fbfefe; }
.npc-feed__item header { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.npc-feed__item p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.npc-feed__item--comment { background: #fff; }
.npc-linkbtn {
  border: 0; background: none; color: var(--accent-deep); font-weight: 700;
  cursor: pointer; padding: 8px 0; min-height: 40px;
}

@media (max-width: 980px) {
  .npc-cols, .npc-cols--2 { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .npc-row { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .npc-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-bottom: 0;
  }
  .npc-top__bar { width: 100%; padding-bottom: 10px; }
  .npc-top__brand p,
  .npc-top__user--desk { display: none; }
  .npc-nav-toggle { display: inline-flex; }

  .npc-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 4px 0 12px;
    border-top: 1px solid rgba(158, 196, 191, 0.2);
  }
  body.npc-nav-open .npc-nav { display: flex; }
  .npc-nav a {
    padding: 14px 4px;
    border-bottom: 1px solid rgba(158, 196, 191, 0.12);
    font-size: 16px;
  }
  .npc-top__user--nav {
    display: flex;
    justify-content: space-between;
    padding: 14px 4px 4px;
    margin-top: 4px;
  }

  .npc-main { padding: 16px 12px 32px; }
  .npc-head { flex-direction: column; align-items: stretch; }
  .npc-head .npc-btn { width: 100%; }
  .npc-head__actions { width: 100%; }
  .npc-head__actions .npc-btn,
  .npc-head__actions form { flex: 1; }
  .npc-head__actions form { display: flex; }
  .npc-head__actions form .npc-btn { width: 100%; }

  .npc-kpis { grid-template-columns: repeat(2, 1fr); }
  .npc-panel { padding: 14px; border-radius: 14px; }
  .npc-form--inline { flex-direction: column; }
  .npc-form--inline .npc-btn { width: 100%; }
  .npc-filters { max-width: none; }
  .npc-auth-title { font-size: 24px; }
  .npc-2fa { grid-template-columns: 1fr; justify-items: center; }
  .npc-btn { width: 100%; }
  .npc-panel .npc-btn,
  .npc-form .npc-btn { width: 100%; }

  .npc-table-wrap { display: none; }
  .npc-cardlist { display: grid; }
}

@media (max-width: 420px) {
  .npc-kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .npc-kpi { padding: 10px; }
  .npc-kpi strong { font-size: 20px; }
  .npc-top__brand strong { font-size: 13px; max-width: 160px; }
}
