/* mapense components. Depends on mapense-tokens.css. Class prefix: mp-
 * The first part (top bar, tool rail, course list) is design/mapense-components.css unchanged;
 * the app's additions follow under their own heading. See design/DESIGN.md.
 */

/* ---------- Base ---------- */
.mp-app {
  font-family: var(--mp-font);
  color: var(--mp-text);
  background: var(--mp-bg);
}
.mp-app button { font-family: inherit; }

/* ---------- Top bar ---------- */
.mp-topbar {
  height: var(--mp-topbar-h);
  box-sizing: border-box;
  padding: 0 var(--mp-space-4);
  display: flex;
  align-items: center;
  gap: var(--mp-space-4);
  background: var(--mp-surface);
  border-bottom: 1px solid var(--mp-border);
}
.mp-topbar__spacer { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mp-divider-v { width: 1px; height: 24px; background: var(--mp-border); }

/* Wordmark: "map" light + "ense" extra bold, always lowercase */
.mp-wordmark { display: flex; align-items: center; gap: var(--mp-space-2); font-size: var(--mp-fs-xl); letter-spacing: -0.035em; }
.mp-wordmark__map  { font-weight: 300; }
.mp-wordmark__ense { font-weight: 800; }

/* Breadcrumb */
.mp-breadcrumb { display: flex; align-items: center; gap: var(--mp-space-2); font-size: var(--mp-fs-md); color: var(--mp-text-muted); }
.mp-breadcrumb a { color: inherit; text-decoration: none; }
.mp-breadcrumb a:hover { color: var(--mp-text); }
.mp-breadcrumb__current { color: var(--mp-text); font-weight: 700; }

/* Chip (e.g. "Karta version 14") */
.mp-chip {
  padding: 4px 10px;
  border-radius: var(--mp-radius-pill);
  font-size: var(--mp-fs-xs);
  font-weight: 700;
  background: var(--mp-forest-tint);
  color: var(--mp-forest-ink);
}

/* Save status text */
.mp-status { font-size: var(--mp-fs-sm); color: var(--mp-text-muted); }

/* Icon button (undo/redo) */
.mp-icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius-md);
  background: var(--mp-surface-raised);
  color: var(--mp-text);
  cursor: pointer;
}
.mp-icon-btn:disabled { opacity: 0.45; cursor: default; }

/* Segmented control (Bana / Vägval / Utskrift) */
.mp-segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--mp-radius-lg);
  background: var(--mp-surface-sunken);
}
.mp-segmented > button {
  height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: var(--mp-radius-sm);
  background: transparent;
  font-size: var(--mp-fs-md);
  font-weight: 600;
  color: var(--mp-text-2);
  cursor: pointer;
}
.mp-segmented > button[aria-pressed="true"] {
  background: var(--mp-surface-raised);
  color: var(--mp-text);
  font-weight: 700;
}

/* Pill buttons */
.mp-btn {
  height: 40px;
  padding: 0 16px;
  border-radius: var(--mp-radius-pill);
  font-size: var(--mp-fs-md);
  font-weight: 700;
  cursor: pointer;
}
.mp-btn--primary   { border: none; background: var(--mp-accent); color: var(--mp-accent-text); }
.mp-btn--secondary { border: 1px solid var(--mp-border-strong); background: var(--mp-surface-raised); color: var(--mp-text); }
.mp-btn--sm { height: 32px; padding: 0 12px; font-size: var(--mp-fs-sm); }

/* Avatar */
.mp-avatar {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--mp-radius-pill);
  background: var(--mp-forest);
  color: #FFFFFF;
  font-size: var(--mp-fs-sm);
  font-weight: 700;
}

/* ---------- Tool rail ---------- */
.mp-rail {
  width: var(--mp-rail-w);
  box-sizing: border-box;
  padding: var(--mp-space-3) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--mp-surface);
  border-right: 1px solid var(--mp-border);
}
.mp-rail__tool {
  width: var(--mp-touch); height: var(--mp-touch);
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: var(--mp-radius-lg);
  background: transparent;
  color: var(--mp-overprint);       /* course tools draw in overprint purple */
  cursor: pointer;
}
.mp-rail__tool:hover { background: var(--mp-surface-sunken); }
.mp-rail__tool[aria-pressed="true"] { background: var(--mp-text); color: #FFFFFF; }
.mp-rail__sep { width: 28px; height: 1px; margin: 4px 0; background: var(--mp-border); }
/* Icons: inline SVG, stroke="currentColor", stroke-width 2, 22x22 */

/* ---------- Course list ---------- */
.mp-panel {
  width: var(--mp-sidepanel-w);
  box-sizing: border-box;
  background: var(--mp-surface);
  border-right: 1px solid var(--mp-border);
}
.mp-section { padding: var(--mp-space-4); display: flex; flex-direction: column; gap: var(--mp-space-2); }
.mp-section__head { display: flex; align-items: center; justify-content: space-between; }
.mp-eyebrow {
  margin: 0;
  font-size: var(--mp-fs-sm);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mp-text-muted);
}

.mp-course {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius-lg);
  background: var(--mp-surface-raised);
  text-align: left;
  cursor: pointer;
}
.mp-course[aria-pressed="true"] { border: 2px solid var(--mp-course-color, var(--mp-accent)); padding: 9px 11px; }
.mp-course__swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--mp-course-color, var(--mp-accent)); }
.mp-course__name { flex: 1; font-size: var(--mp-fs-lg); font-weight: 600; color: var(--mp-text); }
.mp-course[aria-pressed="true"] .mp-course__name { font-weight: 700; }
.mp-course__meta { font-size: var(--mp-fs-sm); color: var(--mp-text-muted); }

/* ==========================================================================
   Below: the app's additions to design/mapense-components.css (the part above
   is that file unchanged). Every value comes from the screens in
   design/screens/; states are ARIA attributes, not extra classes.
   ========================================================================== */

.mp-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Top bar, as used by the app ---------- */
.mp-topbar { flex: none; }
.mp-wordmark,
.north-scope a.mp-wordmark { color: var(--mp-text); text-decoration: none; }
.mp-wordmark__mark { width: 28px; height: 24px; flex: none; }
.mp-breadcrumb { min-width: 0; white-space: nowrap; }
.mp-breadcrumb a,
.north-scope .mp-breadcrumb a { color: inherit; text-decoration: none; }
.mp-breadcrumb a:hover,
.north-scope .mp-breadcrumb a:hover { color: var(--mp-text); }
.mp-breadcrumb__current { overflow: hidden; text-overflow: ellipsis; }
.mp-divider-v { flex: none; }
.mp-avatar { flex: none; }
.mp-icon-btn:hover:not(:disabled) { background: var(--mp-surface-sunken); }
.mp-icon-btn--plain { border-color: transparent; background: transparent; color: var(--mp-text-muted); }

/* ---------- Buttons ---------- */
.mp-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--mp-space-2); box-sizing: border-box; font-family: inherit; text-decoration: none; white-space: nowrap; }
.mp-btn--primary:hover:not(:disabled) { background: var(--mp-accent-strong); }
/* a link drawn as a button keeps the button's text colour (".north-scope a" would make it the accent, on the accent) */
a.mp-btn--primary, .north-scope a.mp-btn--primary { color: var(--mp-accent-text); }
a.mp-btn--secondary, .north-scope a.mp-btn--secondary { color: var(--mp-text); }
a.mp-btn[hidden] { display: none; }
.mp-btn--secondary:hover:not(:disabled) { background: var(--mp-surface); }
.mp-btn:disabled { opacity: .45; cursor: default; }
.mp-btn--lg { height: 48px; padding: 0 20px; font-size: 16px; }
/* a destructive action is a red text link, never a filled button ("Ta bort banan…") */
.mp-link-danger { padding: 0; border: none; background: none; font: inherit; font-size: var(--mp-fs-md); font-weight: 700; color: var(--mp-danger); cursor: pointer; }
.mp-btn:focus-visible, .mp-icon-btn:focus-visible, .mp-rail__tool:focus-visible, .mp-chip-btn:focus-visible,
.mp-segmented > button:focus-visible, .mp-switch:focus-visible, .mp-menu__item:focus-visible, .mp-float__btn:focus-visible {
  outline: 2px solid var(--mp-accent); outline-offset: 2px;
}

/* Tabs look like the segmented control (role="tab" + aria-selected) */
.mp-segmented > [role="tab"][aria-selected="true"] { background: var(--mp-surface-raised); color: var(--mp-text); font-weight: 700; }
.mp-segmented > button { font-family: inherit; white-space: nowrap; }

/* ---------- Status tag ("Utkast", "Träning", "Släppt", "Tävling") ---------- */
.mp-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: var(--mp-radius-pill);
  font-size: var(--mp-fs-xs); font-weight: 700; white-space: nowrap;
  background: var(--mp-neutral-tint); color: var(--mp-neutral-ink);       /* grey: Utkast */
}
.mp-tag--forest { background: var(--mp-forest-tint); color: var(--mp-forest-ink); } /* green: Släppt, Aktiv, a training course plan */
.mp-tag--amber  { background: var(--mp-amber-tag);   color: var(--mp-amber-ink); }  /* amber: Träning as a version status */
.mp-tag--plum   { background: var(--mp-accent-tint); color: var(--mp-accent-ink); } /* plum: Tävling */

/* ---------- Filter chip (a toggle; the chosen one is dark) ---------- */
.mp-chip-btn {
  height: 32px; padding: 0 12px; box-sizing: border-box;
  border: 1px solid var(--mp-border); border-radius: var(--mp-radius-pill);
  background: var(--mp-surface-raised); color: var(--mp-text);
  font-family: inherit; font-size: var(--mp-fs-sm); font-weight: 700; white-space: nowrap; cursor: pointer;
}
.mp-chip-btn[aria-pressed="true"] { border-color: var(--mp-inverse); background: var(--mp-inverse); color: var(--mp-inverse-text); }

/* ---------- Page header and cards (Banor, Kartor, Medlemmar) ---------- */
.mp-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--mp-space-4); flex-wrap: wrap; }
.mp-page-head__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mp-page-head__text > *, .mp-page-head h1 { line-height: normal; } /* (as the design's screens: the font's own line height) */
.mp-page-head .mp-eyebrow { color: var(--mp-forest); }
.mp-page-head h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -0.025em; }
.mp-page-head__lead { margin: 0; font-size: var(--mp-fs-lg); color: var(--mp-text-2); }
.mp-card { background: var(--mp-surface-raised); border: 1px solid var(--mp-border); border-radius: var(--mp-radius-xl); overflow: hidden; }
.mp-card--pad { padding: var(--mp-space-5); }

/* A table drawn as a list: set the columns once with --mp-list-cols on .mp-list */
.mp-list { margin: 0; padding: 0; list-style: none; }
.mp-list__head, .mp-list__row { display: grid; grid-template-columns: var(--mp-list-cols, 1fr); gap: var(--mp-space-4); align-items: center; padding: 14px 20px; }
.mp-list__head { border-bottom: 1px solid var(--mp-border); font-size: var(--mp-fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mp-text-muted); }
.mp-list__row + .mp-list__row { border-top: 1px solid var(--mp-border-soft); }
.mp-list__title, .north-scope a.mp-list__title { color: var(--mp-text); text-decoration: none; font-size: 16px; font-weight: 700; }
.mp-list__sub { font-size: var(--mp-fs-sm); color: var(--mp-text-muted); }
.mp-num { text-align: right; font-size: var(--mp-fs-md); }
.mp-mono { font-family: var(--mp-font-mono); font-size: var(--mp-fs-sm); }

/* ---------- Form fields ---------- */
.mp-field { display: flex; flex-direction: column; gap: 6px; }
.mp-field > label, .mp-field__label { margin-right: 0; font-size: var(--mp-fs-md); font-weight: 700; color: var(--mp-text); }
.mp-input, .mp-select, .mp-textarea {
  height: var(--mp-touch); box-sizing: border-box; padding: 0 14px;
  border: 1px solid var(--mp-border-strong); border-radius: var(--mp-radius-lg);
  background: var(--mp-surface); color: var(--mp-text);
  font-family: inherit; font-size: var(--mp-fs-lg);
}
.mp-textarea { height: auto; min-height: 120px; padding: 10px 14px; resize: vertical; }
.mp-input:focus, .mp-select:focus, .mp-textarea:focus, .mp-valuebox input:focus {
  outline: none; border-color: var(--mp-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mp-accent) 15%, transparent);
}
.mp-help { margin: 0; font-size: var(--mp-fs-xs); line-height: 1.5; color: var(--mp-text-muted); }

/* ---------- Dialog ---------- */
.mp-scrim { position: fixed; inset: 0; z-index: 200; display: grid; place-items: start center; padding: 64px 24px 24px; background: var(--mp-scrim); overflow: auto; }
.mp-scrim[hidden] { display: none; }
.mp-dialog {
  width: 100%; max-width: 520px; box-sizing: border-box;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--mp-surface); color: var(--mp-text);
  border: 1px solid var(--mp-border); border-radius: var(--mp-radius-xl);
  box-shadow: var(--mp-shadow-dialog);
  font-family: var(--mp-font);
}
.mp-dialog--wide { max-width: 680px; }
.mp-dialog__head { padding: 24px 28px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--mp-space-4); }
.mp-dialog__title { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.mp-dialog__close { width: 40px; height: 40px; margin: -4px -8px 0 0; flex: none; border: none; border-radius: var(--mp-radius-md); background: transparent; color: var(--mp-text-muted); font-size: 18px; cursor: pointer; }
.mp-dialog__close:hover { background: var(--mp-surface-sunken); color: var(--mp-text); }
.mp-dialog__body { padding: 0 28px 24px; display: flex; flex-direction: column; gap: 18px; font-size: var(--mp-fs-md); color: var(--mp-text-2); }
.mp-dialog__foot { padding: 16px 28px; border-top: 1px solid var(--mp-border); display: flex; align-items: center; justify-content: flex-end; gap: var(--mp-space-2); }
.mp-dialog__foot-start { margin-right: auto; }

/* ---------- Settings row: label + one-line hint, the control at the right ---------- */
.mp-settings { display: flex; flex-direction: column; }
.mp-settings > .mp-eyebrow, .north-scope .mp-settings > h3.mp-eyebrow { font-size: var(--mp-fs-xs); font-weight: 700; letter-spacing: .1em; line-height: 1.3; color: var(--mp-text-muted); padding-bottom: 4px; margin: 0 0 4px; border-bottom: 1px solid var(--mp-border); }
.mp-settings + .mp-settings { margin-top: 18px; }
.mp-setting { display: flex; align-items: center; justify-content: space-between; gap: var(--mp-space-4); min-height: 46px; padding: 4px 0; }
.mp-setting__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mp-setting__label { font-size: var(--mp-fs-md); font-weight: 600; color: var(--mp-text); }
.mp-setting__hint { font-size: var(--mp-fs-xs); line-height: 1.4; color: var(--mp-text-muted); }
.mp-setting__control { display: flex; align-items: center; gap: 10px; flex: none; }
/* shown only when the value differs from the default */
.mp-setting__reset { padding: 0; border: none; background: none; font: inherit; font-size: var(--mp-fs-sm); font-weight: 700; color: var(--mp-forest); cursor: pointer; }
.mp-setting__reset[hidden] { display: none; }
/* A number is a plain value box with its unit after it, never a slider */
.mp-valuebox { display: inline-flex; align-items: center; gap: 10px; }
.mp-valuebox input {
  width: 76px; height: 38px; box-sizing: border-box; padding: 0 10px; text-align: right;
  border: 1px solid var(--mp-border-strong); border-radius: var(--mp-radius-md);
  background: var(--mp-surface-raised); color: var(--mp-text);
  font-family: inherit; font-size: var(--mp-fs-md);
}
.mp-valuebox__unit { width: 34px; font-size: var(--mp-fs-sm); color: var(--mp-text-muted); }
.mp-setting .mp-select { width: 160px; height: 38px; padding: 0 10px; border-radius: var(--mp-radius-md); background: var(--mp-surface-raised); font-size: var(--mp-fs-md); }

/* ---------- Switch (role="switch" + aria-checked) ---------- */
.mp-switch { width: 40px; height: 24px; padding: 0; flex: none; position: relative; border: none; border-radius: var(--mp-radius-pill); background: var(--mp-border-strong); cursor: pointer; }
.mp-switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: var(--mp-radius-pill); background: #FFFFFF; transition: left 120ms; }
.mp-switch[aria-checked="true"] { background: var(--mp-accent); }
.mp-switch[aria-checked="true"]::after { left: 19px; }

/* ---------- Menu behind a "⋯" button ---------- */
.mp-menu { min-width: 200px; padding: 6px; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px; background: var(--mp-surface); border: 1px solid var(--mp-border); border-radius: var(--mp-radius-float); box-shadow: var(--mp-shadow-dialog); }
.mp-menu[hidden] { display: none; }
.mp-menu__item { min-height: var(--mp-touch); padding: 0 12px; display: flex; align-items: center; gap: 10px; border: none; border-radius: var(--mp-radius-md); background: transparent; color: var(--mp-text); font-family: inherit; font-size: var(--mp-fs-md); font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
.mp-menu__item:hover { background: var(--mp-surface-sunken); }
.mp-menu__item--danger { color: var(--mp-danger); }
.mp-menu__sep { height: 1px; margin: 4px 6px; background: var(--mp-border); }

/* ---------- Floating map control (a glass pill; the map shows through the gaps) ---------- */
.mp-float {
  box-sizing: border-box; min-height: 48px; padding: 0 6px;
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--mp-glass); color: var(--mp-text);
  border: 1px solid var(--mp-border); border-radius: var(--mp-radius-float);
  box-shadow: var(--mp-shadow-float);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-family: var(--mp-font);
}
.mp-float--btn { width: var(--mp-touch); min-height: var(--mp-touch); height: var(--mp-touch); padding: 0; justify-content: center; cursor: pointer; }
.mp-float__btn { min-width: 36px; height: 36px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: var(--mp-radius-md); background: transparent; color: var(--mp-text); font-family: inherit; font-size: var(--mp-fs-md); font-weight: 600; cursor: pointer; }
.mp-float__btn:hover { background: var(--mp-surface-sunken); }
.mp-float__btn[aria-pressed="true"] { background: var(--mp-inverse); color: var(--mp-inverse-text); }

/* ---------- Notes and the error pill ---------- */
.mp-note { padding: 10px 12px; border: 1px solid var(--mp-border); border-radius: var(--mp-radius-lg); background: var(--mp-surface-raised); font-size: var(--mp-fs-sm); line-height: 1.45; color: var(--mp-text-2); }
.mp-note--forest { border-color: transparent; background: var(--mp-forest-tint); color: var(--mp-forest-ink); }
.mp-note--amber  { border-color: var(--mp-amber-border); background: var(--mp-amber-tint); color: var(--mp-amber-ink); }
.mp-toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 300; padding: 10px 16px; display: flex; align-items: center; gap: 10px; border-radius: var(--mp-radius-pill); background: var(--mp-inverse); color: var(--mp-inverse-text); font-family: var(--mp-font); font-size: var(--mp-fs-md); white-space: nowrap; box-shadow: var(--mp-shadow-toast); }
.mp-toast a, .north-scope .mp-toast a { color: inherit; font-weight: 700; }

/* ==========================================================================
   Pages (design step 1: Banor, Kartor, Medlemmar, Versionshistorik)
   ========================================================================== */

/* the page's own title in a card */
.mp-card h2, .mp-card__title { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; color: var(--mp-text); }
.mp-card--list { overflow: visible; } /* (a "⋯" menu of the last row may reach outside the card) */
.mp-card__bar { padding: 14px 20px; display: flex; align-items: center; gap: var(--mp-space-3); border-bottom: 1px solid var(--mp-border); }
.mp-card__bar .mp-input { flex: 1; min-width: 0; height: 38px; border-radius: var(--mp-radius-pill); background: var(--mp-surface-raised); font-size: var(--mp-fs-md); }
.mp-card__note { margin: 0; padding: 10px 20px; border-bottom: 1px solid var(--mp-border-soft); }
.mp-card__note[hidden] { display: none; }
.mp-card__foot { padding: 14px 20px; border-top: 1px solid var(--mp-border); }
.mp-card + .mp-card { margin-top: 20px; }
.mp-cols > .mp-card + .mp-card { margin-top: 0; }

/* the page: a wide column and (optionally) a narrow card at its right */
.mp-page { display: flex; flex-direction: column; gap: 22px; }
.mp-cols { display: flex; gap: 20px; align-items: flex-start; }
.mp-cols__main { flex: 1 1 auto; min-width: 0; }
.mp-cols__side { flex: none; width: 380px; box-sizing: border-box; }
/* Side by side only when the PAGE has room for both (the list needs about 620 px, the card 380): the width that counts is the
   content's, not the window's (the main menu and the margins take 312 px of it). */
.mp-page { container-type: inline-size; }
@container (max-width: 1040px) { .mp-cols { flex-direction: column; align-items: stretch; } .mp-cols__main, .mp-cols__side { width: 100%; } }

/* A real table with the look of the design's lists */
.mp-table { width: 100%; border-collapse: collapse; font-size: var(--mp-fs-md); color: var(--mp-text); }
.mp-table th { padding: 14px 8px; border-bottom: 1px solid var(--mp-border); font-size: var(--mp-fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; text-align: left; color: var(--mp-text-muted); white-space: nowrap; }
.mp-table td { padding: 12px 8px; vertical-align: middle; border-bottom: 0; }
.mp-table tbody tr + tr td { border-top: 1px solid var(--mp-border-soft); }
.mp-table th:first-child, .mp-table td:first-child { padding-left: 20px; }
.mp-table th:last-child, .mp-table td:last-child { padding-right: 20px; }
.mp-table th.mp-num, .mp-table td.mp-num { text-align: right; }
.mp-table__more { width: 36px; text-align: right; }
.mp-dash { color: var(--mp-text-faint); }
.mp-table__empty td { padding: 22px 20px; text-align: center; color: var(--mp-text-muted); }
.mp-table .mp-list__title { font-size: var(--mp-fs-lg); }
.mp-table .mp-list__sub { margin-top: 2px; }
/* The name column takes what the others leave and clips what does not fit (a long file name is one unbreakable word, which
   would otherwise make the table wider than its card, as the design's Kartor screen: one line, an ellipsis). */
.mp-table td:has(> .mp-list__title) { width: 100%; max-width: 0; }
.mp-table td:has(> .mp-list__title) .mp-list__sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-table td:has(> .mp-list__title) .mp-list__title { overflow-wrap: anywhere; }
.mp-table td, .mp-table th { box-sizing: border-box; }
.mp-table a:not(.mp-list__title), .north-scope .mp-table a:not(.mp-list__title) { color: var(--mp-forest); font-weight: 700; }

/* "⋯" and its menu (shared/static/mp_menu.js) */
.mp-menu-wrap { position: relative; display: inline-block; }
.mp-menu-wrap > .mp-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; }
.mp-menu-wrap > [data-mp-menu] { font-size: 18px; line-height: 1; }

/* form in a card */
.mp-form { display: flex; flex-direction: column; gap: var(--mp-space-4); }
.mp-form .mp-btn--lg { width: 100%; }
.mp-field__opt { font-weight: 500; color: var(--mp-text-muted); }
.mp-input--file { height: auto; padding: 9px 12px; font-size: var(--mp-fs-sm); }
/* a big dashed button that opens a chooser ("Välj karta…", a file to drop) */
.mp-pick { width: 100%; min-height: 64px; padding: 8px 14px; box-sizing: border-box; display: flex; align-items: center; gap: var(--mp-space-3); border: 1px dashed var(--mp-border-strong); border-radius: var(--mp-radius-lg); background: var(--mp-surface); color: var(--mp-text); font-family: inherit; text-align: left; cursor: pointer; }
.mp-pick:hover { border-color: var(--mp-forest); }
.mp-pick svg { flex: none; color: var(--mp-forest); }
.mp-pick__text { display: flex; flex-direction: column; min-width: 0; }
.mp-pick__title { font-size: var(--mp-fs-lg); font-weight: 700; }
.mp-pick__sub { font-size: var(--mp-fs-xs); color: var(--mp-text-muted); }
/* radio buttons drawn as a segmented control (the inputs stay real radios) */
.mp-segmented--radio { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.mp-segmented--radio label { margin: 0; cursor: pointer; }
.mp-segmented--radio input { position: absolute; opacity: 0; pointer-events: none; }
.mp-segmented--radio span { display: flex; align-items: center; justify-content: center; height: 34px; padding: 0 12px; border-radius: var(--mp-radius-sm); font-size: var(--mp-fs-md); font-weight: 600; color: var(--mp-text-2); white-space: nowrap; }
.mp-segmented--radio input:checked + span { background: var(--mp-surface-raised); color: var(--mp-text); font-weight: 700; }
.mp-segmented--radio input:focus-visible + span { outline: 2px solid var(--mp-accent); outline-offset: 2px; }
.mp-details > summary { cursor: pointer; font-size: var(--mp-fs-md); font-weight: 700; color: var(--mp-text-2); }
.mp-details[open] > summary { margin-bottom: var(--mp-space-3); }
.mp-status-line { margin: 0; font-size: var(--mp-fs-sm); color: var(--mp-text-muted); }
.mp-status-line:empty { display: none; }
.mp-status-line.error { color: var(--mp-danger); }

/* the search field of a page, in the top bar (block topbar_tools of shell.html) */
.mp-topbar__search { width: 260px; height: 38px; box-sizing: border-box; padding: 0 14px; border: 1px solid var(--mp-border-strong); border-radius: var(--mp-radius-pill); background: var(--mp-surface-raised); color: var(--mp-text); font-family: inherit; font-size: var(--mp-fs-md); }
.mp-topbar__search:focus { outline: none; border-color: var(--mp-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mp-accent) 15%, transparent); }
@media (max-width: 760px) { .mp-topbar__search { width: 150px; } }
.mp-page-head__tools { display: flex; align-items: center; gap: var(--mp-space-4); flex-wrap: wrap; }
.mp-segmented > button[aria-pressed="true"] { background: var(--mp-surface-raised); color: var(--mp-text); font-weight: 700; }
.mp-input[type="date"] { font-family: inherit; }

/* a choice between two things, each a card with a title and a line of explanation (radio buttons underneath) */
.mp-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--mp-space-2); }
.mp-choice label { margin: 0; cursor: pointer; }
.mp-choice input { position: absolute; opacity: 0; pointer-events: none; }
.mp-choice label > span { display: flex; flex-direction: column; gap: 2px; height: 100%; box-sizing: border-box; padding: 12px 14px; border: 1px solid var(--mp-border-strong); border-radius: var(--mp-radius-lg); background: var(--mp-surface-raised); }
.mp-choice strong { font-size: var(--mp-fs-lg); color: var(--mp-text); }
.mp-choice small { font-size: var(--mp-fs-xs); line-height: 1.4; color: var(--mp-text-muted); }
.mp-choice input:checked + span { border: 2px solid var(--mp-accent); padding: 11px 13px; }
.mp-choice input:focus-visible + span { outline: 2px solid var(--mp-accent); outline-offset: 2px; }

/* a settings row's checkbox, and a number box without the browser's arrows (the value is typed) */
.mp-setting input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--mp-accent); cursor: pointer; }
.mp-valuebox input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.mp-valuebox input[type="number"]::-webkit-outer-spin-button, .mp-valuebox input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mp-dialog { max-height: calc(100vh - 88px); }
.mp-dialog__body { overflow-y: auto; }

/* a native <dialog> (opened with showModal) drawn as the mapense dialog */
dialog.mp-native-dialog { padding: 0; margin: 64px auto auto; max-height: calc(100vh - 88px); }
dialog.mp-native-dialog:not([open]) { display: none; }
dialog.mp-native-dialog::backdrop { background: var(--mp-scrim); }
.mp-toast[hidden] { display: none; }
.support-dialog .mp-textarea { width: 100%; min-height: 132px; }

/* ---- Tables on a narrow card (a phone, upright or on its side): a row becomes a little card instead of columns that run out of it. The card is the container, so
   a wide window with a narrow card (a side panel) does the same. mp_table.js puts the column's name on each cell (data-label). ---- */
.mp-card--list, .north-card:has(> table.north-table), .north-card:has(.tk-wrap), .north-card:has(.admin-section), section.admin-section { container-type: inline-size; }
@container (max-width: 640px) {
  .mp-table, .mp-table tbody { display: block; width: 100%; }
  .mp-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .mp-table tr { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 14px 20px; }
  .mp-table tbody tr + tr { border-top: 1px solid var(--mp-border-soft); }
  .mp-table td, .mp-table th:first-child, .mp-table td:first-child, .mp-table td:last-child { display: block; width: auto; max-width: none; padding: 0; border: 0; text-align: left; }
  .mp-table tbody tr + tr td { border-top: 0; }
  .mp-table td:has(> .mp-list__title) { order: 1; flex: 1 1 100%; width: 100%; max-width: none; padding-right: 40px; }
  .mp-table td:first-child:not(:has(> .mp-list__title)) { order: 0; }
  .mp-table td[data-label]:not(.mp-table__more):not(:has(> .mp-list__title)):not(:first-child) { order: 2; font-size: var(--mp-fs-sm); color: var(--mp-text-2); }
  .mp-table td[data-label]:not(.mp-table__more):not(:has(> .mp-list__title)):not(:first-child):not(:empty)::before { content: attr(data-label) " "; color: var(--mp-text-muted); }
  .mp-table td.mp-num { text-align: left; }
  .mp-table td.mp-table__more { position: absolute; right: 10px; top: 8px; width: auto; }
  .mp-table td:empty { display: none; }
  .mp-table__empty td { padding: 4px 0; }
  .mp-table__empty { display: block; }
}
@container (max-width: 960px) {
  .north-table, .north-table tbody { display: block; width: 100%; }
  .north-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  /* the older admin tables: each cell under its column's name */
  .north-table tr { display: block; padding: 12px 18px; border-bottom: 1px solid var(--north-line, var(--mp-border)); }
  .north-table td { display: block; padding: 6px 0; border: 0; }
  .north-table td[data-label]:not(:empty)::before { content: attr(data-label); display: block; margin-bottom: 2px; font: 700 11px var(--mp-font-mono, monospace); letter-spacing: .08em; text-transform: uppercase; color: var(--mp-text-muted); }
  .north-table select, .north-table input:not([type=checkbox]):not([type=radio]) { max-width: 100%; }
}
@container (max-width: 640px) {
  .mp-table td[data-label] { white-space: nowrap; }
  .mp-table td:has(> .mp-list__title) { white-space: normal; }
}
@container (max-width: 960px) {
  .north-table form, .north-table .inline-form { flex-wrap: wrap; max-width: 100%; }
}
