/*
  Mapense design (formerly the NORTH design system -- the --north-* /
  .north-* names are kept so no template or script has to change).
  ------------------------------------------------------------
  Source of truth: the "mapense webbplats" design canvas. Warm paper
  background, Manrope + JetBrains Mono, pill buttons, and the Mapense
  accent purple (#93507F) with the brand green/brown as supporting colours.
  Shared by both the courses (Banläggning) and mapping (Mapper) apps --
  see shared/templates/shell.html, which every page template extends.
  Framework-free by design so either app can load it directly.

  NOTE: --north-blue* is the ACCENT token. It kept its old name because
  ~hundreds of rules reference it; its value is now the Mapense purple.
*/

/* Self-hosted variable fonts (SIL OFL), latin + latin-ext subsets --
   downloaded from Google Fonts into shared/static/fonts/, no external requests. */
@font-face { font-family: "Manrope"; font-weight: 300 800; font-style: normal; font-display: swap;
  src: url("fonts/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Manrope"; font-weight: 300 800; font-style: normal; font-display: swap;
  src: url("fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400 700; font-style: normal; font-display: swap;
  src: url("fonts/jetbrainsmono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400 700; font-style: normal; font-display: swap;
  src: url("fonts/jetbrainsmono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* The colours and fonts are aliases of the mapense tokens (mapense-tokens.css, loaded before this file). New styles use the --mp-* names directly; these stay for the rules already written with them. */
:root {
  --north-bg: var(--mp-bg);
  --north-bg-elevated: var(--mp-surface);
  --north-surface: var(--mp-surface-raised);
  --north-surface-soft: var(--mp-surface-sunken);
  --north-ink: var(--mp-text);
  --north-ink-soft: var(--mp-text-2);
  --north-muted: var(--mp-text-muted);
  --north-faint: var(--mp-text-faint);
  --north-line: var(--mp-border);
  --north-line-strong: var(--mp-border-strong);

  --north-green: var(--mp-forest);
  --north-green-dark: var(--mp-forest-ink);
  --north-green-soft: var(--mp-forest-tint);
  --north-brown: var(--mp-heath);

  --north-blue: var(--mp-accent);
  --north-blue-dark: var(--mp-accent-strong);
  --north-blue-soft: var(--mp-accent-tint);
  --north-contour: rgba(147, 80, 127, .13);
  --north-success: var(--mp-success);
  --north-warning: var(--mp-amber-ink);
  --north-danger: var(--mp-danger);

  --north-radius-sm: 8px;
  --north-radius-md: 12px;
  --north-radius-lg: 18px;
  --north-radius-xl: 24px;

  --north-shadow-sm: 0 1px 2px rgba(27,31,26,.04), 0 6px 18px rgba(27,31,26,.05);
  --north-shadow: 0 2px 5px rgba(27,31,26,.05), 0 18px 42px rgba(27,31,26,.08);
  --north-shadow-lg: 0 4px 12px rgba(27,31,26,.06), 0 30px 70px rgba(27,31,26,.12);

  --north-font: var(--mp-font);
  --north-font-mono: var(--mp-font-mono);

  --north-content: 1160px;
  --north-gutter: clamp(20px, 4vw, 48px);
  --north-speed: 160ms;
}

/* ---------- global foundation ---------- */
.north-app,
.north-scope {
  color: var(--north-ink);
  background: var(--north-bg);
  font-family: var(--north-font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.north-app,
.north-scope { accent-color: var(--north-blue); }

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

.north-scope button,
.north-scope input,
.north-scope select,
.north-scope textarea { font: inherit; }

.north-scope a { color: var(--north-blue); text-underline-offset: 3px; }

.north-display,
.north-scope h1,
.north-scope h2,
.north-scope h3 {
  font-family: var(--north-font);
  color: var(--north-ink);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -.025em;
}

.north-mono,
.north-scope code,
.north-scope kbd,
.north-scope .mono {
  font-family: var(--north-font-mono);
}

/* ---------- application shell ---------- */
/* The frame (design/DESIGN.md: screens banor, kartor, medlemmar): the top bar across the page (.north-frame-top, a
   .mp-topbar from shared/templates/mp_topbar.html), below it the main menu at the left and the page. The map and
   review views (.page-focus: compare, check-in, merge, the map view) have no bar: there the frame is as it was before
   the bar came, the narrow menu with the logo in it, until those views get their own design. */
.north-shell {
  --north-frame-top: var(--mp-topbar-h); /* what sticks below the bar starts here */
  --north-nav-gap: 0px;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--mp-nav-w) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  background: var(--north-bg);
}
body:has(> .north-shell) { margin: 0; } /* (the frame goes to the window's edges; the Banor pages had the browser's 8 px margin around it) */
.north-frame-top { grid-column: 1 / -1; position: sticky; top: 0; z-index: 30; }
.north-shell:has(.page-focus) { --north-frame-top: 0px; --north-nav-gap: 38px; grid-template-rows: none; }
.north-shell:has(.page-focus) .north-frame-top { display: none; }
.north-shell:not(:has(.page-focus)) .north-sidebar > .north-brand { display: none; } /* (the logo is in the bar) */
.north-shell:not(:has(.page-focus)) .north-sidebar { padding: 16px 12px; }

.north-sidebar {
  position: sticky;
  top: var(--north-frame-top);
  height: calc(100vh - var(--north-frame-top));
  padding: 24px 16px;
  border-right: 1px solid var(--north-line);
  background: var(--north-bg-elevated);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.north-main { min-width: 0; }

.north-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--north-ink);
  text-decoration: none;
  font-family: var(--north-font);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.035em;
}

/* The Mapense symbol (two curves meeting in a ring): green + brown + accent
   purple, from references/mapense-logotyp.zip (svg/mapense-symbol.svg). */
.north-mark {
  width: 28px;
  height: 24px;
  flex: none;
  display: inline-block;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='18 28 170 144'%3E%3Cpath d='M30 40C90 40 90 100 120 100' fill='none' stroke='%234F6B55' stroke-width='16' stroke-linecap='round'/%3E%3Cpath d='M30 160C90 160 90 100 120 100' fill='none' stroke='%238B6B4E' stroke-width='16' stroke-linecap='round'/%3E%3Ccircle cx='150' cy='100' r='26' fill='none' stroke='%2393507F' stroke-width='16'/%3E%3C/svg%3E") center / contain no-repeat;
}
.north-mark > i { display: none; }
.north-scope a.north-brand { color: var(--north-ink); }

.north-nav { margin-top: var(--north-nav-gap); display: grid; gap: 4px; }
.north-nav-label {
  padding: 14px 12px 6px;
  color: var(--mp-text-muted);
  font: 700 11px/1.2 var(--mp-font);
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* a row of the main menu: a link, or (.north-nav-row) a button at the bottom of the sidebar */
.north-nav a,
.north-sidebar .north-nav-row { /* (.north-sidebar: above ".north-scope button { font: inherit }") */
  min-height: var(--mp-touch);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--mp-radius-lg);
  background: transparent;
  color: var(--mp-text-2);
  text-decoration: none;
  text-align: left;
  font-size: var(--mp-fs-lg);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--north-speed), color var(--north-speed);
}
.north-nav a svg, .north-nav-row svg { flex: none; }

.north-nav a:hover, .north-nav-row:hover { color: var(--mp-text); background: var(--mp-surface-sunken); }
.north-nav a[aria-current="page"] { color: var(--mp-text); background: var(--mp-surface-sunken); font-weight: 700; }

.north-sidebar-footer { margin-top: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
/* the signed-in user, below the rows (the club's block in the design) */
.north-org-foot { margin-top: 4px; padding: 12px 4px 0 12px; border-top: 1px solid var(--mp-border); display: flex; align-items: center; gap: 10px; min-height: 40px; }
.north-org-foot .north-org-avatar { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.north-org-name { flex: 1; min-width: 0; font-size: var(--mp-fs-md); font-weight: 700; color: var(--mp-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.north-sidebar .north-org-switch { flex: 1; min-width: 0; height: 36px; padding: 0 6px; border: 1px solid transparent; border-radius: var(--mp-radius-md); background: transparent; color: var(--mp-text); font-size: var(--mp-fs-md); font-weight: 700; cursor: pointer; text-overflow: ellipsis; }
.north-sidebar .north-org-switch:hover, .north-sidebar .north-org-switch:focus { border-color: var(--mp-border-strong); background: var(--mp-surface-raised); outline: none; }
.north-sidebar-footer .north-user-foot { padding: 4px 4px 0 12px; display: flex; align-items: center; gap: 10px; }
.north-org-avatar { border-radius: 50%; color: #fff; font-weight: 700; display: grid; place-items: center; flex: 0 0 auto; }
.north-user-avatar { width: 28px; height: 28px; font-size: 11px; background: var(--mp-forest); }
.north-user-info { flex: 1; min-width: 0; line-height: 1.25; }
.north-user-email { font-weight: 600; font-size: 12.5px; color: var(--mp-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.north-user-role { font-size: 11px; color: var(--mp-text-muted); }

.north-topbar {
  height: 68px;
  padding: 0 var(--north-gutter);
  border-bottom: 1px solid var(--north-line);
  background: color-mix(in srgb, var(--north-bg) 88%, transparent);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: var(--north-frame-top);
  z-index: 15;
}

/* ---------- layout ---------- */
/* A page in the mapense design (.mp-page, and the map's page .page-project) has the design's own margins: 28 px above,
   32 px at the sides (24 px for the wide table pages), and the whole width; the measures are the ones of
   design/screens/*.html, checked by tests/browser/scenarios/design_measure.mjs. */
.north-page:has(.mp-page), .north-page:has(.page-project) { padding: 28px 0 48px; }
.north-container:has(.mp-page) { width: calc(100% - 64px); max-width: none; }
.north-container:has(.mp-page--wide), .north-container:has(.page-project) { width: calc(100% - 48px); max-width: none; }
@media (max-width: 680px) { .north-container:has(.mp-page), .north-container:has(.page-project) { width: calc(100% - 32px); } }
.north-container { width: min(var(--north-content), calc(100% - 2 * var(--north-gutter))); margin-inline: auto; }
.north-page { padding: 38px 0 80px; }
.north-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.north-page-header h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); }
.north-page-header p { max-width: 58ch; margin: 10px 0 0; color: var(--north-muted); }

.north-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--north-blue);
  font: 500 10px/1 var(--north-font-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.north-eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; }

/* ---------- surfaces ---------- */
.north-card {
  background: var(--north-surface);
  border: 1px solid var(--north-line);
  border-radius: var(--north-radius-lg);
  box-shadow: var(--north-shadow-sm);
}

.north-card:hover { border-color: var(--north-line-strong); }
.north-card-pad { padding: 22px; }
.north-card-compact { border-radius: var(--north-radius-md); }
.north-card-flat { box-shadow: none; }

.north-grid { display: grid; gap: 16px; }
.north-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.north-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.north-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- buttons ---------- */
.north-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--north-speed), background var(--north-speed), border-color var(--north-speed), color var(--north-speed), box-shadow var(--north-speed);
}
.north-btn:hover { transform: translateY(-1px); }
.north-btn:active { transform: translateY(0); }
.north-btn-primary { background: var(--north-ink); color: var(--north-bg-elevated); box-shadow: 0 1px 1px rgba(0,0,0,.12); }
.north-btn-primary:hover { background: #27302b; }
.north-btn-accent { background: var(--north-blue); color: white; }
.north-btn-accent:hover { background: var(--north-blue-dark); }
.north-btn-secondary { background: var(--north-surface); color: var(--north-ink); border-color: var(--north-line-strong); }
.north-btn-ghost { background: transparent; color: var(--north-muted); }
.north-btn-danger { background: var(--north-danger); color: white; }
.north-btn-sm { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.north-btn-lg { min-height: 44px; padding: 10px 18px; }

/* ---------- forms ---------- */
.north-label { display: block; margin-bottom: 7px; color: var(--north-ink-soft); font-size: 12px; font-weight: 600; }
.north-help { margin-top: 6px; color: var(--north-faint); font-size: 12px; }
.north-input,
.north-select,
.north-textarea {
  width: 100%;
  border: 1px solid var(--north-line-strong);
  border-radius: 9px;
  background: var(--north-surface);
  color: var(--north-ink);
  padding: 9px 11px;
  outline: none;
  transition: border-color var(--north-speed), box-shadow var(--north-speed);
}
.north-input:focus,
.north-select:focus,
.north-textarea:focus { border-color: var(--north-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--north-blue) 15%, transparent); }
.north-textarea { min-height: 120px; resize: vertical; }
.north-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.north-field-full { grid-column: 1 / -1; }

/* ---------- status / metadata ---------- */
.north-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font: 500 11px/1 var(--north-font-mono);
  border: 1px solid var(--north-line);
  background: var(--north-surface-soft);
  color: var(--north-muted);
}
.north-badge-blue { color: var(--north-blue); background: var(--north-blue-soft); border-color: color-mix(in srgb, var(--north-blue) 25%, var(--north-line)); }
.north-badge-success { color: var(--north-success); background: color-mix(in srgb, var(--north-success) 10%, var(--north-surface)); }
.north-badge-warning { color: var(--north-warning); background: color-mix(in srgb, var(--north-warning) 10%, var(--north-surface)); }
.north-badge-danger { color: var(--north-danger); background: color-mix(in srgb, var(--north-danger) 10%, var(--north-surface)); }

.north-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.north-meta { color: var(--north-faint); font: 11px/1.4 var(--north-font-mono); }

/* ---------- tables / lists ---------- */
.north-table { width: 100%; border-collapse: collapse; }
.north-table th {
  padding: 10px 14px;
  color: var(--north-faint);
  font: 500 10px/1.2 var(--north-font-mono);
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
  border-bottom: 1px solid var(--north-line);
}
.north-table td { padding: 13px 14px; border-bottom: 1px solid var(--north-line); vertical-align: middle; }
.north-table tr:last-child td { border-bottom: 0; }
.north-table tbody tr:hover { background: var(--north-surface-soft); }

.north-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.north-list li { display: flex; align-items: flex-start; gap: 9px; color: var(--north-ink-soft); }
.north-list li::before { content: "✓"; color: var(--north-success); font-family: var(--north-font-mono); }

/* ---------- map / version visual language ---------- */
.north-map {
  position: relative;
  overflow: hidden;
  min-height: 280px;
  border: 1px solid var(--north-line);
  border-radius: var(--north-radius-lg);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--north-blue) 7%, transparent) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(color-mix(in srgb, var(--north-blue) 7%, transparent) 1px, transparent 1px) 0 0 / 42px 42px,
    var(--north-surface);
}

.north-map::before {
  content: "";
  position: absolute;
  inset: -10% -5%;
  opacity: .7;
  background:
    radial-gradient(ellipse 24% 17% at 26% 48%, transparent 48%, var(--north-contour) 49% 50%, transparent 51% 58%, var(--north-contour) 59% 60%, transparent 61% 68%, var(--north-contour) 69% 70%, transparent 71%),
    radial-gradient(ellipse 20% 14% at 68% 34%, transparent 48%, var(--north-contour) 49% 50%, transparent 51% 58%, var(--north-contour) 59% 60%, transparent 61% 68%, var(--north-contour) 69% 70%, transparent 71%);
  pointer-events: none;
}

.north-map-grid { position: absolute; inset: 0; background: linear-gradient(135deg, transparent 49.7%, color-mix(in srgb, var(--north-blue) 20%, transparent) 50%, transparent 50.3%); opacity: .25; }
.north-map-label { position: absolute; left: 18px; top: 16px; color: var(--north-faint); font: 10px var(--north-font-mono); letter-spacing: .12em; text-transform: uppercase; }
.north-map-north { position: absolute; right: 20px; top: 18px; display: grid; gap: 4px; justify-items: center; color: var(--north-ink); font: 600 11px var(--north-font-mono); }
.north-map-north::after { content: "↑"; font-size: 22px; line-height: .8; }

.north-version {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--north-line);
}
.north-version:last-child { border-bottom: 0; }
.north-version-node { width: 10px; height: 10px; margin: auto; border-radius: 50%; background: var(--north-surface); border: 2px solid var(--north-blue); position: relative; }
.north-version-node::after { content: ""; position: absolute; top: 8px; left: 2px; width: 2px; height: 36px; background: var(--north-line-strong); }
.north-version:last-child .north-version-node::after { display: none; }
.north-version-current .north-version-node { background: var(--north-blue); }
.north-version-title { color: var(--north-ink); font-weight: 600; }
.north-version-desc { margin-top: 2px; color: var(--north-muted); font-size: 13px; }

/* ---------- drop zone ---------- */
.north-dropzone {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--north-line-strong);
  border-radius: var(--north-radius-lg);
  background: var(--north-bg-elevated);
  color: var(--north-muted);
  transition: border-color var(--north-speed), background var(--north-speed), color var(--north-speed);
}
.north-dropzone:hover,
.north-dropzone.is-dragover { border-color: var(--north-blue); background: var(--north-blue-soft); color: var(--north-ink); }
.north-dropzone strong { color: var(--north-ink); }

/* ---------- command/search ---------- */
.north-search {
  position: relative;
  display: flex;
  align-items: center;
}
.north-search input { padding-left: 36px; }
.north-search svg { position: absolute; left: 12px; color: var(--north-faint); pointer-events: none; }

/* ---------- empty state ---------- */
.north-empty { padding: 64px 24px; text-align: center; }
.north-empty h2 { margin: 10px 0 8px; font-size: 26px; }
.north-empty p { max-width: 48ch; margin: 0 auto 20px; color: var(--north-muted); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .north-shell { grid-template-columns: 72px minmax(0, 1fr); }
  .north-sidebar { padding-inline: 10px; }
  .north-brand span:not(.north-mark) { display: none; }
  .north-nav-label { display: none; }
  .north-nav a, .north-sidebar .north-nav-row { justify-content: center; font-size: 0; }
  .north-nav a svg, .north-nav-row svg { width: 20px; height: 20px; }
  .north-shell:not(:has(.page-focus)) .north-sidebar { padding-inline: 10px; }
  .north-sidebar-footer .north-user-foot, .north-org-foot { padding-left: 0; padding-right: 0; justify-content: center; flex-wrap: wrap; }
  .north-sidebar-footer .north-user-info, .north-org-name, .north-sidebar .north-org-switch { display: none; }
  .north-grid-3,
  .north-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .north-shell { display: block; }
  .north-sidebar,
  .north-shell:not(:has(.page-focus)) .north-sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; height: 62px; padding: 6px 10px; border-right: 0; border-top: 1px solid var(--north-line); flex-direction: row; align-items: center; }
  .north-sidebar > .north-brand,
  .north-sidebar-footer,
  .north-nav-label { display: none; }
  .north-nav { margin: 0; display: flex; flex: 1; justify-content: space-around; }
  .north-nav a { min-width: 48px; }
  .north-main { padding-bottom: 62px; }
  .north-grid-2,
  .north-grid-3,
  .north-grid-4,
  .north-form-grid { grid-template-columns: 1fr; }
  .north-field-full { grid-column: auto; }
  .north-page-header { display: block; }
}

/* ---------- modal (release notes, etc.) ---------- */
.north-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 21, 19, .45);
}
.north-modal-overlay[hidden] { display: none; }
.north-modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 82vh;
  overflow: auto;
  padding: 26px 26px 22px;
  background: var(--north-surface);
  border-radius: var(--north-radius-lg);
  box-shadow: var(--north-shadow-lg);
}
.north-modal-close { position: absolute; top: 14px; right: 14px; }
.north-modal-entry { margin-top: 18px; }
.north-modal-entry:first-of-type { margin-top: 14px; }
.north-modal-entry h3 { margin: 0 0 6px; font-size: 15px; }
.north-modal-entry p { margin: 0 0 8px; color: var(--north-ink-soft); }
.north-modal-entry ul { margin: 0 0 8px; padding-left: 20px; color: var(--north-ink-soft); }
.north-modal-entry li { margin: 4px 0; }
.north-modal-actions { margin-top: 22px; display: flex; justify-content: flex-end; }

/* ---------- shell adapter (gitmap-specific, not part of upstream north.css) ---------- */
/* Legacy per-app markup (.appbar/.brand/.glyph, badge-draft/training/released)
   is being retired page by page in favour of shell.html -- these bridge
   rules keep any not-yet-converted page and the version-status vocabulary
   readable under the new tokens without a second parallel stylesheet. */
.badge-draft, .badge-training, .badge-released {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 3px 8px;
  border-radius: 999px; font: 500 11px/1 var(--north-font-mono); border: 1px solid var(--north-line);
}
.badge-draft { color: var(--north-muted); background: var(--north-surface-soft); }
.badge-training { color: var(--north-warning); background: color-mix(in srgb, var(--north-warning) 10%, var(--north-surface)); }
.badge-released { color: var(--north-success); background: color-mix(in srgb, var(--north-success) 10%, var(--north-surface)); }

/* ---------- top bar of the course editor ---------- */
/* The bar of the Mapense design: logo, app switch, the view's own tools, the user. Used by the course editor's bar
   (courses/templates/editor.html; ids for editor.js). The map views keep the sidebar. */
.north-appbar {
  height: 56px;
  flex: none;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--north-bg-elevated);
  border-bottom: 1px solid var(--north-line);
  position: relative;
  z-index: 20;
}
.north-appbar-nav { display: flex; gap: 2px; }
.north-appbar-nav a,
.north-scope .north-appbar-nav a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--north-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.north-appbar-nav a:hover { background: var(--north-surface-soft); color: var(--north-ink); }
.north-appbar-nav a.active,
.north-scope .north-appbar-nav a.active { background: var(--north-blue-soft); color: var(--north-blue); }
.north-appbar-sep { width: 1px; height: 24px; background: var(--north-line); flex: none; }
.north-appbar-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--north-muted); }
.north-appbar-crumbs a,
.north-scope .north-appbar-crumbs a { color: var(--north-muted); text-decoration: none; white-space: nowrap; }
.north-appbar-crumbs a:hover { color: var(--north-ink); }
.north-appbar-crumbs .here { color: var(--north-ink); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.north-appbar-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--north-green-soft);
  color: var(--north-green-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.north-appbar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.north-appbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--north-green);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}

/* ---------- a phone, upright or on its side ---------- */
@media (max-width: 680px) {
  /* nine menu buttons share the bar instead of running out of it */
  .north-nav { min-width: 0; }
  .north-nav a, .north-sidebar .north-nav-row { flex: 1 1 0; min-width: 0 !important; padding-inline: 0; }
}
@media (max-width: 560px) {
  /* the top bar: the page's own name is the heading below it, so the bar keeps the logo, the search and the avatar */
  .mp-topbar:has(.mp-topbar__search) .mp-breadcrumb, .mp-topbar:has(.mp-topbar__search) .mp-divider-v { display: none; }
  .mp-topbar__spacer { flex: 1; min-width: 0; justify-content: flex-end; }
  .mp-topbar__search { width: auto; flex: 1; min-width: 0; }
}
@media (max-height: 520px) and (min-width: 681px) {
  /* on its side the menu rail is shorter than its buttons: it scrolls */
  .north-sidebar { overflow-y: auto; }
  .north-nav a, .north-sidebar .north-nav-row { min-height: 36px; }
}
