/* ==========================================================================
   nxt-ig.css — Nxtcure internal docs design system
   --------------------------------------------------------------------------
   One stylesheet shared by every surface: the dynamic admin screens compiled
   per request by adminapp.py, the statically compiled wiki documents, and the
   login page. The typst sources cannot import across directories (compile_html.sh
   forbids `../`), so the shared look lives here and each htmllib.typ links it by
   absolute url instead of duplicating the css.

   Theming is driven by [data-theme] on <html>, set before first paint by the
   inline boot snippet each htmllib.typ emits, and toggled by nxt-theme.js.
   Everything below is expressed in custom properties so light and dark are the
   same rules with a different palette.
   ========================================================================== */

/* ---------- palette ------------------------------------------------------ */

:root,
[data-theme="dark"] {
  --nxt-canvas: #000000;
  --nxt-surface: #121212;
  --nxt-raised: #1c1c1e;
  --nxt-nav-bg: #000000;
  --nxt-input-bg: #121212;

  --nxt-hairline: #262626;
  --nxt-hairline-strong: #3a3a3a;

  --nxt-text: #f5f5f5;
  --nxt-muted: #a8a8a8;
  --nxt-faint: #737373;

  --nxt-primary: #0095f6;
  --nxt-primary-hover: #1877f2;
  --nxt-danger: #ed4956;
  --nxt-success: #2fb457;
  --nxt-warning: #e5a600;

  --nxt-hover: rgba(255, 255, 255, 0.06);
  --nxt-active: rgba(255, 255, 255, 0.1);
  --nxt-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
  --nxt-code-bg: #1c1c1e;

  color-scheme: dark;
}

[data-theme="light"] {
  --nxt-canvas: #fafafa;
  --nxt-surface: #ffffff;
  --nxt-raised: #ffffff;
  --nxt-nav-bg: #ffffff;
  --nxt-input-bg: #fafafa;

  --nxt-hairline: #dbdbdb;
  --nxt-hairline-strong: #c7c7c7;

  --nxt-text: #262626;
  --nxt-muted: #8e8e8e;
  --nxt-faint: #a8a8a8;

  --nxt-primary: #0095f6;
  --nxt-primary-hover: #1877f2;
  --nxt-danger: #ed4956;
  --nxt-success: #1f9d4f;
  --nxt-warning: #b57e00;

  --nxt-hover: rgba(0, 0, 0, 0.05);
  --nxt-active: rgba(0, 0, 0, 0.08);
  --nxt-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --nxt-code-bg: #f1f1f1;

  color-scheme: light;
}

:root {
  /* the instagram brand sweep, used sparingly: wordmark, avatar rings, accents */
  --nxt-gradient: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  --nxt-nav-w: 245px;
  --nxt-nav-w-collapsed: 72px;
  --nxt-bottombar-h: 52px;
  --nxt-radius: 12px;
  --nxt-radius-sm: 8px;
  --nxt-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --nxt-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

/* ---------- base --------------------------------------------------------- */

html {
  background: var(--nxt-canvas);
}

body {
  margin: 0;
  background: var(--nxt-canvas);
  color: var(--nxt-text);
  font-family: var(--nxt-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* typst's html export opens the body with a paragraph holding the <link> and
   <script> elements; it carries a default margin that shows as a blank band */
body > p:first-child:empty,
body > p:first-child {
  margin-top: 0;
}

a {
  color: var(--nxt-text);
  text-decoration: none;
}
a:hover {
  text-decoration: none;
}

.nxt-link {
  color: var(--nxt-primary);
  font-weight: 600;
}
.nxt-link:hover {
  color: var(--nxt-primary-hover);
}

hr {
  border: 0;
  border-top: 1px solid var(--nxt-hairline);
  margin: 16px 0;
  opacity: 1;
}

::selection {
  background: rgba(0, 149, 246, 0.3);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--nxt-hairline);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--nxt-hairline-strong);
}

/* ---------- app shell ---------------------------------------------------- */

/* every admin screen sits to the right of the fixed nav rail */
html.nxt-app body {
  padding-left: var(--nxt-nav-w);
}

.nxt-page {
  max-width: 975px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* tables and the crm need more room than instagram's 975px feed column */
.nxt-page-wide {
  max-width: 1320px;
}

.nxt-page-narrow {
  max-width: 640px;
}

.nxt-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}

/* when a chrome page is embedded (the dashboard iframe) hide the nav so the
   shell never nests inside itself */
html.nxt-embedded .nxt-nav,
html.nxt-embedded .nxt-topbar {
  display: none;
}
html.nxt-embedded body {
  padding-left: 0;
}

/* ---------- navigation --------------------------------------------------- */

.nxt-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--nxt-nav-w);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px 20px;
  background: var(--nxt-nav-bg);
  border-right: 1px solid var(--nxt-hairline);
  z-index: 40;
}

.nxt-wordmark {
  display: block;
  padding: 25px 12px 16px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--nxt-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  white-space: nowrap;
}

.nxt-wordmark-mark {
  display: none;
  padding: 25px 0 16px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--nxt-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.nxt-nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border-radius: var(--nxt-radius-sm);
  color: var(--nxt-text);
  transition: background 0.15s ease;
  white-space: nowrap;
}
.nxt-nav-item:hover {
  background: var(--nxt-hover);
}
.nxt-nav-item:active {
  background: var(--nxt-active);
}
.nxt-nav-item .bi {
  font-size: 1.5rem;
  line-height: 1;
  flex: 0 0 24px;
  text-align: center;
}
.nxt-nav-item.active {
  font-weight: 700;
}
.nxt-nav-label {
  font-size: 1rem;
}

.nxt-nav-spacer {
  flex: 1;
}

/* gradient ring avatar, instagram's signature affordance */
.nxt-avatar {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--nxt-gradient);
  padding: 2px;
  box-sizing: border-box;
  display: grid;
  place-items: center;
}
.nxt-avatar > span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--nxt-nav-bg);
  color: var(--nxt-text);
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}
/* no auto margins here: the profile header is a flex row, and `margin: 0 auto`
   would resolve against the free space and push the name block off to the right */
.nxt-avatar-xl {
  width: 96px;
  height: 96px;
  padding: 3px;
}
.nxt-avatar-xl > span {
  background: var(--nxt-surface);
  font-size: 2.25rem;
}

.nxt-theme-toggle {
  background: none;
  border: 0;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
}
/* one glyph per theme; kept unscoped so the login page's toggle, which is a
   plain button rather than a nav row, gets the same swap */
.nxt-theme-dark-only {
  display: none;
}
[data-theme="dark"] .nxt-theme-dark-only {
  display: inline;
}
[data-theme="dark"] .nxt-theme-light-only {
  display: none;
}

/* tablet: collapse to icons, the way instagram does under 1264px */
@media (max-width: 1263px) {
  html.nxt-app body {
    padding-left: var(--nxt-nav-w-collapsed);
  }
  .nxt-nav {
    width: var(--nxt-nav-w-collapsed);
    padding: 8px 8px 20px;
    align-items: stretch;
  }
  .nxt-nav-label,
  .nxt-wordmark {
    display: none;
  }
  .nxt-wordmark-mark {
    display: block;
  }
  .nxt-nav-item {
    justify-content: center;
    gap: 0;
  }
}

/* phone: instagram drops the rail for a bottom bar */
@media (max-width: 767px) {
  html.nxt-app body {
    padding-left: 0;
    padding-bottom: var(--nxt-bottombar-h);
  }
  .nxt-nav {
    top: auto;
    right: 0;
    bottom: 0;
    width: auto;
    height: var(--nxt-bottombar-h);
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    gap: 0;
    padding: 0 4px;
    border-right: 0;
    border-top: 1px solid var(--nxt-hairline);
  }
  .nxt-wordmark-mark,
  .nxt-nav-spacer {
    display: none;
  }
  .nxt-nav-item {
    padding: 10px;
  }
  .nxt-page {
    padding: 16px 12px 32px;
  }
}

/* ---------- cards -------------------------------------------------------- */

.nxt-card {
  background: var(--nxt-surface);
  border: 1px solid var(--nxt-hairline);
  border-radius: var(--nxt-radius);
  margin-bottom: 20px;
  overflow: hidden;
}

.nxt-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--nxt-hairline);
}

.nxt-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.nxt-card-sub {
  color: var(--nxt-muted);
  font-size: 0.8rem;
}

.nxt-card-body {
  padding: 20px;
}

.nxt-card-body-flush {
  padding: 0;
}

.nxt-empty {
  color: var(--nxt-muted);
  font-size: 0.9rem;
  margin: 0;
  padding: 8px 0;
}

/* ---------- buttons ------------------------------------------------------ */

.nxt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--nxt-radius-sm);
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.nxt-btn-primary {
  background: var(--nxt-primary);
  color: #ffffff;
}
.nxt-btn-primary:hover {
  background: var(--nxt-primary-hover);
  color: #ffffff;
}

.nxt-btn-secondary {
  background: var(--nxt-hover);
  color: var(--nxt-text);
}
.nxt-btn-secondary:hover {
  background: var(--nxt-active);
}

.nxt-btn-ghost {
  background: transparent;
  border-color: var(--nxt-hairline);
  color: var(--nxt-text);
}
.nxt-btn-ghost:hover {
  background: var(--nxt-hover);
}

.nxt-btn-danger {
  background: transparent;
  border-color: var(--nxt-hairline);
  color: var(--nxt-danger);
}
.nxt-btn-danger:hover {
  background: rgba(237, 73, 86, 0.12);
}

.nxt-btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.nxt-btn-icon {
  padding: 8px 10px;
}

.nxt-btn-block {
  width: 100%;
}

.nxt-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- forms -------------------------------------------------------- */

.nxt-input,
.nxt-select,
.nxt-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--nxt-input-bg);
  border: 1px solid var(--nxt-hairline);
  border-radius: var(--nxt-radius-sm);
  padding: 10px 12px;
  color: var(--nxt-text);
  font-family: inherit;
  font-size: 0.9rem;
}
.nxt-input::placeholder,
.nxt-textarea::placeholder {
  color: var(--nxt-muted);
}
.nxt-input:focus,
.nxt-select:focus,
.nxt-textarea:focus {
  outline: none;
  border-color: var(--nxt-hairline-strong);
}
.nxt-textarea {
  resize: vertical;
  min-height: 96px;
}
.nxt-select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.nxt-input-sm,
.nxt-select-sm {
  padding: 7px 10px;
  font-size: 0.85rem;
}
.nxt-select-sm {
  padding-right: 28px;
}
.nxt-field-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.nxt-field {
  margin-bottom: 10px;
}
.nxt-w-auto {
  width: auto;
}

/* search bar: instagram's rounded, low-contrast field */
.nxt-searchbar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.nxt-searchbar .nxt-input {
  border-radius: 999px;
  padding-left: 16px;
}

/* ---------- tables ------------------------------------------------------- */

.nxt-table-wrap {
  overflow-x: auto;
}

.nxt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.nxt-table th {
  text-align: left;
  padding: 10px 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nxt-muted);
  border-bottom: 1px solid var(--nxt-hairline);
  white-space: nowrap;
}
.nxt-table td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--nxt-hairline);
  vertical-align: middle;
}
.nxt-table tbody tr:last-child td {
  border-bottom: 0;
}
.nxt-table tbody tr {
  transition: background 0.12s ease;
}
.nxt-table tbody tr:hover {
  background: var(--nxt-hover);
}
.nxt-table-num {
  color: var(--nxt-muted);
  font-variant-numeric: tabular-nums;
}
.nxt-cell-muted {
  color: var(--nxt-muted);
}

.nxt-filename {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  color: var(--nxt-text);
}
.nxt-filename:hover {
  color: var(--nxt-primary);
}
.nxt-filename .bi,
.nxt-filename .mdi {
  font-size: 1.15rem;
  color: var(--nxt-muted);
}
.nxt-filename .nxt-ico-dir {
  color: var(--nxt-primary);
}
.nxt-filename .nxt-ico-doc {
  color: var(--nxt-muted);
}

/* ---------- pills / badges ----------------------------------------------- */

.nxt-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--nxt-hover);
  color: var(--nxt-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.nxt-pill-primary {
  background: rgba(0, 149, 246, 0.14);
  color: var(--nxt-primary);
}
.nxt-pill-success {
  background: rgba(47, 180, 87, 0.16);
  color: var(--nxt-success);
}
.nxt-pill-danger {
  background: rgba(237, 73, 86, 0.14);
  color: var(--nxt-danger);
}
.nxt-pill-warning {
  background: rgba(229, 166, 0, 0.16);
  color: var(--nxt-warning);
}

.nxt-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 0.85rem;
  color: var(--nxt-muted);
}
.nxt-stat b {
  color: var(--nxt-text);
  font-weight: 700;
}

.nxt-alert {
  border: 1px solid var(--nxt-hairline);
  border-left: 3px solid var(--nxt-danger);
  border-radius: var(--nxt-radius-sm);
  background: var(--nxt-surface);
  color: var(--nxt-text);
  padding: 12px 16px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ---------- login -------------------------------------------------------- */

.nxt-login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  box-sizing: border-box;
}

.nxt-login-card {
  width: 100%;
  max-width: 350px;
  box-sizing: border-box;
  background: var(--nxt-surface);
  border: 1px solid var(--nxt-hairline);
  border-radius: var(--nxt-radius);
  padding: 40px 36px 28px;
  text-align: center;
}

.nxt-login-card .nxt-wordmark {
  display: block;
  padding: 0 0 8px;
  font-size: 2.25rem;
  text-align: center;
}

.nxt-login-tagline {
  color: var(--nxt-muted);
  font-size: 0.85rem;
  margin: 0 0 24px;
}

.nxt-login-card .nxt-input {
  margin-bottom: 8px;
}

.nxt-login-card .nxt-btn {
  margin-top: 8px;
}

.nxt-login-foot {
  width: 100%;
  max-width: 350px;
  box-sizing: border-box;
  background: var(--nxt-surface);
  border: 1px solid var(--nxt-hairline);
  border-radius: var(--nxt-radius);
  padding: 18px;
  text-align: center;
  color: var(--nxt-muted);
  font-size: 0.85rem;
}

/* ---------- profile ------------------------------------------------------ */

.nxt-profile-head {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 8px 0 24px;
  border-bottom: 1px solid var(--nxt-hairline);
  margin-bottom: 20px;
}
.nxt-profile-name {
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0 0 10px;
}
.nxt-profile-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  color: var(--nxt-text);
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.nxt-profile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .nxt-profile-head {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  .nxt-profile-meta {
    justify-content: center;
  }
  .nxt-profile-actions {
    justify-content: center;
  }
}

/* ---------- calendar (meeting notes) ------------------------------------- */

.nxt-cal {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  text-align: center;
  margin-bottom: 22px;
  font-size: 0.85rem;
}
.nxt-cal th {
  padding: 6px 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nxt-muted);
}
.nxt-cal td {
  padding: 3px 0;
  color: var(--nxt-faint);
}
.nxt-cal-month {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 4px 0 8px;
}
a.nxt-cal-note {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--nxt-primary);
  color: #ffffff;
  font-weight: 700;
}
a.nxt-cal-note:hover {
  background: var(--nxt-primary-hover);
  color: #ffffff;
}

.nxt-cat-cols {
  column-count: 2;
  column-gap: 28px;
}
@media (max-width: 900px) {
  .nxt-cat-cols {
    column-count: 1;
  }
}
.nxt-cat {
  break-inside: avoid;
  margin-bottom: 20px;
}
.nxt-cat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--nxt-muted);
  margin-bottom: 8px;
}
.nxt-cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nxt-cat-list li {
  margin-bottom: 2px;
}
.nxt-cat-list a {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--nxt-text);
  font-size: 0.85rem;
}
.nxt-cat-list a:hover {
  background: var(--nxt-hover);
}

.nxt-scroll {
  overflow-y: auto;
}

/* ---------- modal (bootstrap markup, our skin) --------------------------- */

.modal-content.nxt-modal {
  background: var(--nxt-surface);
  color: var(--nxt-text);
  border: 1px solid var(--nxt-hairline);
  border-radius: var(--nxt-radius);
}
.nxt-modal .modal-header,
.nxt-modal .modal-footer {
  border-color: var(--nxt-hairline);
}
.nxt-modal .modal-title {
  font-size: 1rem;
  font-weight: 700;
}

/* ---------- chat --------------------------------------------------------- */

.nxt-chat {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
@media (max-width: 767px) {
  .nxt-chat {
    height: calc(100vh - var(--nxt-bottombar-h));
  }
}

.nxt-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--nxt-hairline);
  background: var(--nxt-nav-bg);
}

.nxt-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px;
}

.nxt-chat-inner {
  max-width: 780px;
  margin: 0 auto;
}

.nxt-msg {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}
.nxt-msg.user {
  justify-content: flex-end;
}

/* the user's turn reads as an instagram DM bubble */
.nxt-msg.user .nxt-msg-body {
  max-width: 78%;
  background: var(--nxt-primary);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 0.925rem;
}

.nxt-msg.assistant .nxt-msg-body {
  flex: 1;
  min-width: 0;
}

.nxt-msg-content {
  background: var(--nxt-surface);
  border: 1px solid var(--nxt-hairline);
  border-radius: var(--nxt-radius);
  padding: 18px 20px;
  font-size: 0.925rem;
  line-height: 1.65;
}

.nxt-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--nxt-muted);
  align-items: center;
}
.nxt-sources a {
  padding: 2px 10px;
  border: 1px solid var(--nxt-hairline);
  border-radius: 999px;
  color: var(--nxt-primary);
  font-weight: 600;
}
.nxt-sources a:hover {
  background: var(--nxt-hover);
}

.nxt-chat-foot {
  padding: 16px 24px 22px;
  border-top: 1px solid var(--nxt-hairline);
  background: var(--nxt-canvas);
}
.nxt-chat-form {
  display: flex;
  gap: 10px;
  max-width: 780px;
  margin: 0 auto;
}
.nxt-chat-form .nxt-input {
  border-radius: 999px;
  padding: 11px 18px;
}
.nxt-chat-form .nxt-btn {
  border-radius: 999px;
  padding-left: 22px;
  padding-right: 22px;
}

/* markdown rendered client side by marked into .nxt-md */
.nxt-md {
  white-space: pre-wrap;
}
.nxt-md.nxt-md-ready {
  white-space: normal;
}
.nxt-md > :first-child {
  margin-top: 0;
}
.nxt-md > :last-child {
  margin-bottom: 0;
}
.nxt-md h1,
.nxt-md h2,
.nxt-md h3,
.nxt-md h4,
.nxt-md h5,
.nxt-md h6 {
  margin: 1.1em 0 0.5em;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.nxt-md h1 {
  font-size: 1.4rem;
}
.nxt-md h2 {
  font-size: 1.2rem;
}
.nxt-md h3 {
  font-size: 1.05rem;
}
.nxt-md p {
  margin: 0 0 1em;
}
.nxt-md ul,
.nxt-md ol {
  margin: 0 0 1em;
  padding-left: 1.4em;
}
.nxt-md li {
  margin-bottom: 0.35em;
}
.nxt-md code {
  background: var(--nxt-code-bg);
  border-radius: 5px;
  padding: 0.15em 0.4em;
  font-family: var(--nxt-mono);
  font-size: 0.85em;
}
.nxt-md pre {
  background: var(--nxt-code-bg);
  border: 1px solid var(--nxt-hairline);
  border-radius: var(--nxt-radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 1em;
}
.nxt-md pre code {
  background: none;
  padding: 0;
  font-size: 0.85em;
}
.nxt-md blockquote {
  margin: 0 0 1em;
  padding-left: 14px;
  border-left: 3px solid var(--nxt-hairline-strong);
  color: var(--nxt-muted);
}
.nxt-md a {
  color: var(--nxt-primary);
  font-weight: 600;
}
.nxt-md a:hover {
  text-decoration: underline;
}
.nxt-md table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1em;
  font-size: 0.9em;
}
.nxt-md th,
.nxt-md td {
  border: 1px solid var(--nxt-hairline);
  padding: 7px 10px;
  text-align: left;
}
.nxt-md img {
  max-width: 100%;
  border-radius: var(--nxt-radius-sm);
}

/* ---------- dashboard ---------------------------------------------------- */

.nxt-dash-frame {
  display: block;
  width: 100%;
  height: 100vh;
  border: 0;
  background: var(--nxt-canvas);
}
@media (max-width: 767px) {
  .nxt-dash-frame {
    height: calc(100vh - var(--nxt-bottombar-h));
  }
}

/* index album grid, the wiki landing page */
.nxt-album {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.nxt-album-card {
  background: var(--nxt-surface);
  border: 1px solid var(--nxt-hairline);
  border-radius: var(--nxt-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.nxt-album-card:hover {
  transform: translateY(-2px);
  border-color: var(--nxt-hairline-strong);
}
.nxt-album-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--nxt-raised);
  display: block;
}
.nxt-album-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.nxt-album-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  flex: 1;
}
.nxt-album-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nxt-hero {
  text-align: center;
  padding: 56px 20px 40px;
}
.nxt-hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
  background: var(--nxt-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.nxt-hero p {
  color: var(--nxt-muted);
  font-size: 1.05rem;
  margin: 0 0 22px;
}
.nxt-hero-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- wiki documents ----------------------------------------------- */

/* the statically compiled pages under research/, documentation/, meetingnotes/,
   reprints/ — a single centred reading column with a slim top bar */
.nxt-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  background: var(--nxt-nav-bg);
  border-bottom: 1px solid var(--nxt-hairline);
}
.nxt-topbar .nxt-wordmark {
  padding: 0;
  font-size: 1.25rem;
}
.nxt-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nxt-doc {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 96px;
  font-size: 15px;
  line-height: 1.75;
}
.nxt-doc-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  line-height: 1.2;
}
.nxt-doc-rule {
  height: 3px;
  width: 56px;
  border-radius: 3px;
  background: var(--nxt-gradient);
  margin-bottom: 32px;
}
.nxt-doc h2,
.nxt-doc h3,
.nxt-doc h4 {
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 1.8em 0 0.6em;
}
.nxt-doc h2 {
  font-size: 1.4rem;
}
.nxt-doc h3 {
  font-size: 1.15rem;
}
.nxt-doc h4 {
  font-size: 1rem;
}
.nxt-doc p {
  margin: 0 0 1.15em;
}
.nxt-doc a {
  color: var(--nxt-primary);
  font-weight: 500;
}
.nxt-doc a:hover {
  text-decoration: underline;
}
.nxt-doc ul,
.nxt-doc ol {
  padding-left: 1.4em;
  margin: 0 0 1.15em;
}
.nxt-doc li {
  margin-bottom: 0.4em;
}
.nxt-doc img,
.nxt-doc svg {
  max-width: 100%;
  height: auto;
  border-radius: var(--nxt-radius-sm);
}
.nxt-doc code {
  background: var(--nxt-code-bg);
  border-radius: 5px;
  padding: 0.15em 0.4em;
  font-family: var(--nxt-mono);
  font-size: 0.87em;
}
.nxt-doc pre {
  background: var(--nxt-code-bg);
  border: 1px solid var(--nxt-hairline);
  border-radius: var(--nxt-radius-sm);
  padding: 16px;
  overflow-x: auto;
  margin: 0 0 1.3em;
}
.nxt-doc pre code {
  background: none;
  padding: 0;
}
.nxt-doc blockquote {
  margin: 0 0 1.3em;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--nxt-hairline-strong);
  color: var(--nxt-muted);
}
.nxt-doc blockquote cite {
  display: block;
  margin-top: 6px;
  font-size: 0.85em;
  font-style: normal;
  color: var(--nxt-faint);
}
.nxt-doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.3em;
  font-size: 0.92em;
}
.nxt-doc th,
.nxt-doc td {
  border: 1px solid var(--nxt-hairline);
  padding: 8px 12px;
  text-align: left;
}
.nxt-doc th {
  background: var(--nxt-raised);
  font-weight: 700;
}
.nxt-doc hr {
  margin: 2em 0;
}

/* ---------- utilities ---------------------------------------------------- */

.nxt-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.nxt-col {
  min-width: 0;
  flex: 1;
}
.nxt-col-4 {
  flex: 0 0 360px;
}
@media (max-width: 1100px) {
  .nxt-row {
    flex-direction: column;
  }
  .nxt-col-4 {
    flex: 1 1 auto;
    width: 100%;
  }
}
.nxt-ml-auto {
  margin-left: auto;
}
.nxt-mb-0 {
  margin-bottom: 0;
}
.nxt-gap {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.nxt-muted {
  color: var(--nxt-muted);
}
