*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

:root {
  --np-ice: #ecf4fb;
  --np-white: #ffffff;
  --np-navy: #17222e;
  --np-blue: #117fcd;
  --np-tint: #acd2ee;
  --np-radius: 14px;
  --np-shadow: 0 10px 30px rgba(23, 34, 46, 0.08);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, sans-serif;
}

html {
  overflow-x: clip;
}

body.np-canvas {
  margin: 0;
  background: var(--np-ice);
  color: var(--np-navy);
  max-width: 100%;
  overflow-x: clip;
}

a { color: #0b5f91; }

.np-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  padding: 12px 14px;
  background: var(--np-white);
  border-bottom: 1px solid #d7e7f5;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.np-logo {
  display: block;
  height: 34px;
  width: auto;
  max-width: min(58vw, 200px);
  object-fit: contain;
  flex-shrink: 1;
}

.np-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.np-shell {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  box-sizing: border-box;
  min-width: 0;
}

@media (min-width: 980px) {
  .np-shell {
    grid-template-columns: 1fr 1.15fr;
    align-items: start;
  }
}

.np-card {
  background: var(--np-white);
  border: 1px solid #d7e7f5;
  border-radius: var(--np-radius);
  box-shadow: var(--np-shadow);
  padding: 16px;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.np-muted { color: #2b3b4a; opacity: 0.85; }

.np-center { max-width: 520px; margin: 64px auto; padding: 18px; }

label { display: block; font-weight: 600; margin: 12px 0 6px; }

input[type="url"],
input[type="password"],
input[type="file"] {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid #c9daf0;
  background: var(--np-white);
  color: var(--np-navy);
  min-height: 44px;
  font-size: 16px;
}

button {
  margin-top: 14px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 44px;
  font-weight: 650;
  cursor: pointer;
  background: var(--np-blue);
  color: var(--np-navy);
}

.np-secondary {
  width: auto;
  margin: 0;
  background: var(--np-tint);
}

.np-consent { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }

.np-error { color: #7a1024; background: #fdecef; border: 1px solid #f3b6c3; padding: 10px; border-radius: 12px; }

.np-banner.fixture {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #8db6d6;
  background: #eaf5fb;
  color: var(--np-navy);
}

.np-badge {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eaf5fb;
  border: 1px solid #8db6d6;
  color: var(--np-navy);
  white-space: normal;
  text-align: center;
  max-width: 100%;
  line-height: 1.25;
}

.np-stage-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
  min-width: 0;
}

@media (max-width: 520px) {
  .np-stage-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .np-stage p {
    font-size: 12px;
  }
  .np-header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .np-badge {
    flex: 1 1 auto;
    min-width: 0;
  }
  button#logout-btn,
  .np-header .np-secondary {
    flex-shrink: 0;
  }
}

.np-stage {
  border: 1px solid #d7e7f5;
  border-radius: 12px;
  padding: 10px;
  background: #fbfdff;
}
.np-stage span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--np-tint);
  color: var(--np-navy);
  font-weight: 750;
}
.np-stage p { margin: 8px 0 0; font-size: 13px; color: var(--np-navy); }
.np-stage.is-active { outline: 2px solid #6fa9d6; }

.np-composer,
.np-workspace,
.np-lesson {
  min-width: 0;
  max-width: 100%;
}

.np-workspace { min-height: 240px; }

#proof-summary,
#expiry-line {
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.np-page-top,
.np-banner.fixture {
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

@media (max-width: 979px) {
  .np-shell { padding: 12px; }
  .np-header { padding: 10px 12px; }
  .np-card { padding: 14px; }
  .np-lesson-scroll {
    max-height: min(48vh, 560px);
  }
  .np-proof-scroll {
    max-height: min(44vh, 480px);
  }
}

.np-lesson-scroll {
  max-height: min(62vh, 720px);
  overflow: auto;
  padding-right: 4px;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.np-page-top {
  margin: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.np-reading {
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 16px;
  line-height: 1.55;
  margin: 0;
  max-width: 100%;
  min-width: 0;
}

.np-reading a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.np-table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.6rem 0;
}

.np-table-scroll table.np-md-table {
  margin: 0;
  min-width: min(100%, 18rem);
}

.np-reading h1,
.np-reading h2,
.np-reading h3 {
  color: var(--np-navy);
  margin: 1.1rem 0 0.6rem;
  line-height: 1.25;
}

.np-reading h2 { font-size: 1.25rem; }
.np-reading h3 { font-size: 1.05rem; }
.np-reading p { margin: 0.5rem 0; }
.np-reading ul { margin: 0.4rem 0 0.8rem 1.1rem; }
.np-reading table.np-md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0.6rem 0;
}
.np-reading table.np-md-table th,
.np-reading table.np-md-table td {
  border: 1px solid #c9daf0;
  padding: 6px 8px;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 14rem;
}

.np-proof-heading {
  font-size: 1rem;
  margin: 14px 0 8px;
}

.np-proof-box {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.45;
  max-height: min(42vh, 520px);
  overflow: auto;
  margin: 0 0 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #c9daf0;
  background: #fbfdff;
}

.np-proof-scroll {
  max-height: min(38vh, 420px);
  overflow: auto;
  padding-right: 4px;
  max-width: 100%;
  min-width: 0;
}

.np-downloads-end {
  margin: 16px 0 8px;
  font-size: 14px;
}

.np-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
  max-width: 100%;
}
.np-tab {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid #c9daf0;
  background: var(--np-white);
  padding: 10px 8px;
  font-weight: 650;
  font-size: clamp(14px, 3.8vw, 16px);
}
.np-tab.is-active {
  background: var(--np-tint);
  border-color: #6fa9d6;
}

.np-download-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 100%;
}
.np-download-list li { margin: 8px 0; }
.np-download-list a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.np-header .np-secondary {
  width: auto;
  margin: 0;
  flex-shrink: 0;
  padding-inline: 12px;
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
