html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* iPhone Safari zooms in on any field with text smaller than 16px when it is tapped,
   and stays zoomed. Keep form fields at 16px on small screens. */
@media (max-width: 767.98px) {
  .form-control,
  .form-control-sm,
  .form-select,
  .form-select-sm,
  textarea,
  select,
  input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]) {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--bs-body-bg), 0 0 0 0.25rem var(--app-focus, #258cfb);
}

/* The footer stays in the normal page flow and is pushed to the bottom of short pages.
   (It used to be pinned to the bottom of <html> with position: absolute, which on iPhone
   could leave it, and the space above the tab bar, floating mid-page when scrolling.) */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* No rubber-band bounce when pulling past the top or bottom of a page: on iPhone the bounce
   drags the page away from the fixed bars, so the tab bar looks like it comes loose */
html,
body {
  overscroll-behavior-y: none;
}

body > .footer {
  margin-top: auto;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}
/* Profile pictures */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-lg {
  width: 56px;
  height: 56px;
}

.avatar-xl {
  width: 112px;
  height: 112px;
}

/* The 12 preset pictures fill even rows: 6 + 6 where there is room, otherwise 4 + 4 + 4
   (on the narrowest phones the pictures shrink a little to keep 4 per row) */
.avatar-picker {
  container-type: inline-size;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: 0.5rem;
}

@container (min-width: 440px) {
  .avatar-grid {
    grid-template-columns: repeat(6, max-content);
  }
}

@container (max-width: 289.98px) {
  .avatar-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .avatar-option > .avatar {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }
}

.avatar-option {
  cursor: pointer;
  border-radius: 50%;
  padding: 3px;
  border: 3px solid transparent;
}

.avatar-option:has(input:checked) {
  border-color: var(--app-focus, #258cfb);
}

.avatar-option:has(input:focus-visible) {
  outline: 2px solid var(--app-focus, #258cfb);
  outline-offset: 2px;
}

/* Expenses history: years and months fold open */
.expense-year > summary,
.expense-month > summary {
  cursor: pointer;
  list-style: none;
}

.expense-year > summary::-webkit-details-marker,
.expense-month > summary::-webkit-details-marker {
  display: none;
}

.expense-year > summary > span:first-child::before,
.expense-month > summary > span:first-child::before {
  content: "▸";
  display: inline-block;
  width: 1.2em;
  transition: transform 0.15s;
}

.expense-year[open] > summary > span:first-child::before,
.expense-month[open] > summary > span:first-child::before {
  transform: rotate(90deg);
}

/* Visit calendar: a week-number column plus Monday–Sunday */
.visit-calendar {
  display: grid;
  grid-template-columns: 2rem repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--bs-border-color);
  border-left: 1px solid var(--bs-border-color);
}

.visit-calendar > div {
  border-right: 1px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color);
}

.vc-head {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  padding: 0.25rem 0;
  background: var(--bs-tertiary-bg);
}

.vc-week {
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
  text-align: center;
  padding-top: 0.3rem;
  background: var(--bs-tertiary-bg);
}

.vc-day {
  min-height: 5rem;
  padding: 0.2rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.vc-day:hover {
  background: var(--bs-light-bg-subtle, #f8f9fa);
}

.vc-other {
  background: var(--bs-tertiary-bg);
}

.vc-other .vc-num,
.vc-past .vc-num {
  color: var(--bs-secondary-color);
}

.vc-num {
  font-size: 0.8rem;
}

.vc-today .vc-num {
  display: inline-block;
  background: var(--app-focus, #258cfb);
  color: var(--app-focus-fg, #fff);
  border-radius: 999px;
  padding: 0 0.4rem;
  align-self: flex-start;
}

.vc-day.vc-selected {
  background: var(--app-selected, #d6e9ff);
  box-shadow: inset 0 0 0 2px var(--app-focus, #258cfb);
}

.vc-visit {
  display: block;
  font-size: 0.75rem;
  line-height: 1.3;
  border-radius: 4px;
  padding: 0 0.25rem;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vc-visit:hover {
  color: #fff;
  filter: brightness(0.9);
}

.vc-initial {
  display: none;
}

@media (max-width: 575.98px) {
  .vc-day {
    min-height: 3.5rem;
  }

  .vc-icons,
  .vc-name {
    display: none;
  }

  .vc-initial {
    font-weight: 600;
    display: inline;
  }
}

.vc-dot {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  vertical-align: baseline;
}

/* One colour per person (see Visits/Index.cshtml.cs ColorFor) */
.person-1 { background: #2f6fde; }
.person-2 { background: #d9480f; }
.person-3 { background: #2b8a3e; }
.person-4 { background: #ae3ec9; }
.person-5 { background: #0c8599; }
.person-6 { background: #c2255c; }
.person-7 { background: #5c7cfa; }
.person-8 { background: #8f6b00; }

/* Chatt */
/* Like an SMS conversation: your own messages on the right (no picture or name),
   everyone else's on the left with their picture and name */
.chat {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
  max-width: 42rem;
}

.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 85%;
  align-self: flex-start;
}

.chat-mine {
  align-self: flex-end;
}

.chat-avatar {
  flex: none;
}

.chat-bubble {
  min-width: 0;
  background: var(--app-bubble, #f1f3f5);
  border: 1px solid var(--bs-border-color-translucent);
  border-radius: 1rem 1rem 1rem 0.25rem;
  padding: 0.4rem 0.75rem 0.5rem;
}

.chat-mine .chat-bubble {
  background: var(--app-bubble-mine, #d3e4f3);
  border-color: transparent;
  border-radius: 1rem 1rem 0.25rem 1rem;
}

.chat-mine .chat-meta {
  justify-content: flex-end;
}

.chat-mine .chat-meta form {
  margin-left: 0 !important;
  order: -1;
}

.chat-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.5rem;
  font-size: 0.875rem;
}

.chat-meta time {
  font-size: 0.8rem;
}

.chat-delete {
  font-size: 0.8rem;
  text-decoration: none;
}

.chat-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-form {
  background: var(--bs-body-bg);
  padding: 0.5rem 0;
  max-width: 42rem;
}

/* The chat fills the screen like a messaging app, on phones (in the app too), tablets and
   computers: only the messages scroll, and the message box stays at the bottom, above the
   tab bar on phones. While the phone keyboard is open, the script on the Chatt page sets
   --chat-h to the height that is still visible, so the message box sits on the keyboard.
   If the window is too low to fit everything, the page scrolls as usual. */
body.page-chat {
  min-height: 0;
  height: 100vh;
  height: var(--chat-h, 100dvh);
}

/* The tab bar is hidden while typing (_TabBar.cshtml), so its space goes to the chat */
body.page-chat:has(.app-tabbar-hidden) {
  padding-bottom: 0;
}

body.page-chat > .container {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-chat main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

.page-chat .chat {
  flex: 1 1 auto;
  min-height: 8rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Keeps the hidden "Du" labels (visually-hidden is position: absolute) inside the
     scrolling list; otherwise they stretch the page and bring its scrollbar back */
  position: relative;
  margin-bottom: 0;
  padding-right: 0.5rem;
}

.page-chat .chat-form {
  padding-bottom: 0.75rem;
}

/* The footer would sit below the message box; the Integritet link is on every other page */
body.page-chat > .footer {
  display: none;
}

@media (min-width: 768px) {
  .page-chat .chat {
    min-height: 12rem;
  }

  .page-chat .chat-form {
    padding-bottom: 1rem;
  }
}

/* With the side menu (computers) the chat uses the whole width next to the menu instead of
   a narrow column, while each bubble stays a comfortable width to read */
@media (min-width: 992px) {
  body.page-chat > .container {
    max-width: none;
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .page-chat .chat,
  .page-chat .chat-form {
    max-width: none;
  }

  .page-chat .chat-message {
    max-width: min(70%, 44rem);
  }
}

/* Menu bar: its colours come from the colour scheme (defaults are the original look) */
.navbar.app-navbar {
  background-color: var(--app-nav-bg, #fff);
  --bs-navbar-color: var(--app-nav-fg, var(--bs-body-color));
  --bs-navbar-hover-color: var(--app-nav-fg, var(--bs-body-color));
  --bs-navbar-active-color: var(--app-nav-fg, var(--bs-body-color));
  --bs-navbar-brand-color: var(--app-nav-fg, var(--bs-emphasis-color));
  --bs-navbar-brand-hover-color: var(--app-nav-fg, var(--bs-emphasis-color));
}

.app-navbar .nav-link {
  color: var(--bs-navbar-color);
}

/* Colour schemes, chosen per person on Min profil (see Services/ColorSchemes.cs).
   "Is på älven" is the default: no data-scheme attribute (in dark mode the
   layout script switches it to the dark scheme). The other light schemes use a
   tinted page with lighter cards. Is på älven has a white page (Sara's choice), so
   cards and text boxes are told apart by their borders; it also has darker text and
   a deeper blue for links and buttons than Bootstrap's own (WCAG AA). */
html:not([data-scheme]) {
  --app-nav-bg: #ffffff;
  --app-card: #ffffff;
  --app-accent: #0a58ca;
  --app-accent-hover: #084298;
  --app-accent-fg: #ffffff;
  --app-focus: #0b5ed7;
  --app-bubble: #ffffff;
  --app-bubble-mine: #d6e6f7;
  --app-bubble-mine-border: #b3cbe4;
  --app-input: #ffffff;
  --app-input-border: #8494a3;
  --bs-body-bg: #ffffff;
  --bs-body-bg-rgb: 255, 255, 255;
  --bs-body-color: #1b2733;
  --bs-body-color-rgb: 27, 39, 51;
  --bs-emphasis-color: #0f1820;
  --bs-secondary-color: #46515c;
  --bs-tertiary-bg: #eef3f7;
  --bs-border-color: #b8c6d2;
  --bs-border-color-translucent: rgba(27, 39, 51, 0.2);
  --bs-primary: #0a58ca;
  --bs-primary-rgb: 10, 88, 202;
  --bs-link-color: #0a58ca;
  --bs-link-color-rgb: 10, 88, 202;
  --bs-link-hover-color: #084298;
  --bs-link-hover-color-rgb: 8, 66, 152;
}

/* Text boxes get a border dark enough to see where to type (3:1 against the box) */
html:not([data-scheme]) .form-control,
html:not([data-scheme]) .form-select,
html:not([data-scheme]) .form-check-input {
  border-color: var(--app-input-border);
}

html:not([data-scheme]) .chat-mine .chat-bubble {
  border-color: var(--app-bubble-mine-border);
}

/* Bootstrap's grey buttons are a little too pale on the tinted page */
html:not([data-scheme]) .btn-secondary {
  --bs-btn-bg: #5c6670;
  --bs-btn-border-color: #5c6670;
  --bs-btn-hover-bg: #4a535c;
  --bs-btn-hover-border-color: #4a535c;
  --bs-btn-active-bg: #4a535c;
  --bs-btn-active-border-color: #4a535c;
}

html:not([data-scheme]) .btn-outline-secondary {
  --bs-btn-color: #4a535c;
  --bs-btn-border-color: #6f7b86;
  --bs-btn-hover-bg: #4a535c;
  --bs-btn-hover-border-color: #4a535c;
  --bs-btn-active-bg: #4a535c;
  --bs-btn-active-border-color: #4a535c;
}

html[data-scheme="granris"] {
  --app-nav-bg: #2f6b4f;
  --app-nav-fg: #ffffff;
  --app-card: #f6f8f1;
  --app-accent: #2f6b4f;
  --app-accent-hover: #255a41;
  --app-accent-fg: #ffffff;
  --app-focus: #2f6b4f;
  --app-selected: #d8e8dd;
  --app-bubble: #f6f8f1;
  --app-bubble-mine: #d8e8dd;
  --bs-body-bg: #e8eee4;
  --bs-body-bg-rgb: 232, 238, 228;
  --bs-body-color: #1f2a24;
  --bs-body-color-rgb: 31, 42, 36;
  --bs-tertiary-bg: #dde6d9;
  --bs-border-color: #c9d4c4;
  --app-input: #fbfcf8;
  --bs-primary: #2f6b4f;
  --bs-primary-rgb: 47, 107, 79;
  --bs-link-color: #2f6b4f;
  --bs-link-color-rgb: 47, 107, 79;
  --bs-link-hover-color: #255a41;
  --bs-link-hover-color-rgb: 37, 90, 65;
}

html[data-scheme="branntunna"] {
  --app-nav-bg: #8e2b1f;
  --app-nav-fg: #ffffff;
  --app-card: #fcf5ec;
  --app-accent: #8e2b1f;
  --app-accent-hover: #75231a;
  --app-accent-fg: #ffffff;
  --app-focus: #8e2b1f;
  --app-selected: #f3dcd6;
  --app-bubble: #fcf5ec;
  --app-bubble-mine: #f3dcd6;
  --bs-body-bg: #f3e6d6;
  --bs-body-bg-rgb: 243, 230, 214;
  --bs-body-color: #2b1d18;
  --bs-body-color-rgb: 43, 29, 24;
  --bs-tertiary-bg: #eadac6;
  --bs-border-color: #dccbb6;
  --app-input: #fffbf6;
  --bs-primary: #8e2b1f;
  --bs-primary-rgb: 142, 43, 31;
  --bs-link-color: #8e2b1f;
  --bs-link-color-rgb: 142, 43, 31;
  --bs-link-hover-color: #75231a;
  --bs-link-hover-color-rgb: 117, 35, 26;
}

html[data-scheme="saras-stuga"] {
  --app-nav-bg: #f4c6d7;
  --app-nav-fg: #4a1f30;
  --app-card: #fff4f7;
  --app-accent: #c2477a;
  --app-accent-hover: #a83a67;
  --app-accent-fg: #ffffff;
  --app-focus: #c2477a;
  --app-selected: #f8d3e1;
  --app-bubble: #fff4f7;
  --app-bubble-mine: #f8d3e1;
  --bs-body-bg: #f9e1ea;
  --bs-body-bg-rgb: 249, 225, 234;
  --bs-body-color: #3a1a26;
  --bs-body-color-rgb: 58, 26, 38;
  --bs-tertiary-bg: #f2d2de;
  --bs-border-color: #e8c3d1;
  --app-input: #fffafc;
  --bs-primary: #c2477a;
  --bs-primary-rgb: 194, 71, 122;
  --bs-link-color: #b03a6c;
  --bs-link-color-rgb: 176, 58, 108;
  --bs-link-hover-color: #922f59;
  --bs-link-hover-color-rgb: 146, 47, 89;
}

/* Saras stuga: dark grey with deep rose and pink */
html[data-scheme="saras-stuga-mork"] {
  --app-nav-bg: #7a3d56;
  --app-nav-fg: #fbe9f0;
  --app-card: #2e2b30;
  --app-accent: #e48aae;
  --app-accent-hover: #eca3c0;
  --app-accent-fg: #2a0f1b;
  --app-focus: #e48aae;
  --app-focus-fg: #2a0f1b;
  --app-selected: #4d3341;
  --app-bubble: #2e2b30;
  --app-bubble-mine: #5a3a4b;
  --bs-body-bg: #232125;
  --bs-body-bg-rgb: 35, 33, 37;
  --bs-body-color: #ece3e7;
  --bs-body-color-rgb: 236, 227, 231;
  --bs-secondary-bg: #3a363c;
  --bs-tertiary-bg: #29262b;
  --bs-border-color: #45404a;
  --bs-primary: #e48aae;
  --bs-primary-rgb: 228, 138, 174;
  --bs-link-color: #f0a6c4;
  --bs-link-color-rgb: 240, 166, 196;
  --bs-link-hover-color: #f7c4d9;
  --bs-link-hover-color-rgb: 247, 196, 217;
}

html[data-scheme="angermanalven"] {
  --app-nav-bg: #1b2420;
  --app-nav-fg: #e6efe9;
  --app-card: #1e2724;
  --app-accent: #5fb08a;
  --app-accent-hover: #74c09c;
  --app-accent-fg: #0d1411;
  --app-focus: #5fb08a;
  --app-focus-fg: #0d1411;
  --app-selected: #24443a;
  --app-bubble: #1e2724;
  --app-bubble-mine: #2a5446;
  --bs-body-bg: #121816;
  --bs-body-bg-rgb: 18, 24, 22;
  --bs-body-color: #dfe7e2;
  --bs-body-color-rgb: 223, 231, 226;
  --bs-secondary-bg: #26312d;
  --bs-tertiary-bg: #1a2320;
  --bs-border-color: #33413b;
  --bs-primary: #5fb08a;
  --bs-primary-rgb: 95, 176, 138;
  --bs-link-color: #7cc6a2;
  --bs-link-color-rgb: 124, 198, 162;
  --bs-link-hover-color: #9dd8bb;
  --bs-link-hover-color-rgb: 157, 216, 187;
}

html[data-scheme="natt-pa-corner"] {
  --app-nav-bg: #141a2e;
  --app-nav-fg: #e8ebf5;
  --app-card: #1a2138;
  --app-accent: #f0b54a;
  --app-accent-hover: #f4c56f;
  --app-accent-fg: #1a1406;
  --app-focus: #f0b54a;
  --app-focus-fg: #1a1406;
  --app-selected: #2a3558;
  --app-bubble: #1a2138;
  --app-bubble-mine: #303f70;
  --bs-body-bg: #0e1322;
  --bs-body-bg-rgb: 14, 19, 34;
  --bs-body-color: #dde2f0;
  --bs-body-color-rgb: 221, 226, 240;
  --bs-secondary-bg: #222a45;
  --bs-tertiary-bg: #151b2e;
  --bs-border-color: #2e3858;
  --bs-primary: #f0b54a;
  --bs-primary-rgb: 240, 181, 74;
  --bs-link-color: #8fb4ff;
  --bs-link-color-rgb: 143, 180, 255;
  --bs-link-hover-color: #b3ccff;
  --bs-link-hover-color-rgb: 179, 204, 255;
}

/* Bootstrap pieces whose blue is fixed in its CSS rather than read from --bs-primary */
html:not([data-scheme]) .card,
html[data-scheme] .card {
  --bs-card-bg: var(--app-card);
}

/* Lists (checklists, shopping) look like cards on light schemes */
html:not([data-bs-theme="dark"]) .list-group {
  --bs-list-group-bg: var(--app-card, var(--bs-body-bg));
}

/* Text boxes on light schemes: a little lighter than the cards */
html:not([data-bs-theme="dark"]) .form-control:not(:disabled),
html:not([data-bs-theme="dark"]) .form-select:not(:disabled) {
  background-color: var(--app-input, var(--bs-body-bg));
}

html:not([data-scheme]) .btn-primary,
html[data-scheme] .btn-primary {
  --bs-btn-color: var(--app-accent-fg);
  --bs-btn-bg: var(--app-accent);
  --bs-btn-border-color: var(--app-accent);
  --bs-btn-hover-color: var(--app-accent-fg);
  --bs-btn-hover-bg: var(--app-accent-hover);
  --bs-btn-hover-border-color: var(--app-accent-hover);
  --bs-btn-active-color: var(--app-accent-fg);
  --bs-btn-active-bg: var(--app-accent-hover);
  --bs-btn-active-border-color: var(--app-accent-hover);
  --bs-btn-disabled-color: var(--app-accent-fg);
  --bs-btn-disabled-bg: var(--app-accent);
  --bs-btn-disabled-border-color: var(--app-accent);
  --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}

html:not([data-scheme]) .btn-outline-primary,
html[data-scheme] .btn-outline-primary {
  --bs-btn-color: var(--app-accent);
  --bs-btn-border-color: var(--app-accent);
  --bs-btn-hover-color: var(--app-accent-fg);
  --bs-btn-hover-bg: var(--app-accent);
  --bs-btn-hover-border-color: var(--app-accent);
  --bs-btn-active-color: var(--app-accent-fg);
  --bs-btn-active-bg: var(--app-accent);
  --bs-btn-active-border-color: var(--app-accent);
  --bs-btn-disabled-color: var(--app-accent);
  --bs-btn-disabled-border-color: var(--app-accent);
  --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}

html:not([data-scheme]) .form-check-input:checked,
html[data-scheme] .form-check-input:checked {
  background-color: var(--app-accent);
  border-color: var(--app-accent);
}

html:not([data-scheme]) .form-control:focus,
html:not([data-scheme]) .form-select:focus,
html:not([data-scheme]) .form-check-input:focus,
html[data-scheme] .form-control:focus,
html[data-scheme] .form-select:focus,
html[data-scheme] .form-check-input:focus {
  border-color: var(--app-focus);
}

html:not([data-scheme]) .nav-pills,
html[data-scheme] .nav-pills {
  --bs-nav-pills-link-active-bg: var(--app-accent);
  --bs-nav-pills-link-active-color: var(--app-accent-fg);
}

html:not([data-scheme]) .list-group,
html[data-scheme] .list-group {
  --bs-list-group-active-bg: var(--app-accent);
  --bs-list-group-active-border-color: var(--app-accent);
  --bs-list-group-active-color: var(--app-accent-fg);
}

html[data-scheme] footer a {
  color: var(--bs-link-color);
}

/* Scheme picker on Min profil */
.scheme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.5rem;
}

.scheme-option {
  cursor: pointer;
  border: 2px solid var(--bs-border-color);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--bs-body-bg);
}

.scheme-option:has(input:checked) {
  border-color: var(--app-focus, #258cfb);
  box-shadow: 0 0 0 1px var(--app-focus, #258cfb);
}

.scheme-option:has(input:focus-visible) {
  outline: 2px solid var(--app-focus, #258cfb);
  outline-offset: 2px;
}

.scheme-swatches {
  display: flex;
  height: 2rem;
}

.scheme-swatches i {
  flex: 1;
  border-right: 1px solid rgba(128, 128, 128, 0.2);
}

.scheme-swatches i:last-child {
  border-right: 0;
}

.scheme-name {
  display: block;
  padding: 0.3rem 0.5rem;
  font-size: 0.875rem;
}

.scheme-option:has(input:checked) .scheme-name {
  font-weight: 600;
}

/* Checklistor and Inköpslista: ticked items are struck through */
.checklist-done .checklist-text {
  text-decoration: line-through;
  color: var(--bs-secondary-color);
}

.shopping,
.narrow-list {
  max-width: 36rem;
}

/* Stugpärm: keep the line breaks people type */
.info-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Phone tab bar (Pages/Shared/_TabBar.cshtml): fixed to the bottom of the screen for signed-in
   phones, replacing the ☰ menu. It takes the menu bar's colours from the colour scheme. */
.app-tabbar,
.app-phone-profile {
  display: none;
}

@media (max-width: 767.98px) {
  body.has-tabbar {
    --tabbar-h: calc(3.75rem + env(safe-area-inset-bottom));
    padding-bottom: var(--tabbar-h);
  }

  .has-tabbar .app-menu-toggle,
  .has-tabbar .navbar-collapse {
    display: none !important;
  }

  .has-tabbar .app-phone-profile {
    display: block;
  }

  .has-tabbar .app-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    height: var(--tabbar-h);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background-color: var(--app-nav-bg, var(--bs-body-bg));
    border-top: 1px solid var(--bs-border-color);
    box-shadow: 0 -0.25rem 0.75rem rgba(0, 0, 0, 0.06);
    /* Own layer, so iPhone Safari keeps it in place while scrolling */
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  /* Hidden while the phone keyboard is open (the script in _TabBar.cshtml sets this):
     iPhone otherwise leaves the bar floating in the middle of the screen above the keyboard */
  .has-tabbar .app-tabbar.app-tabbar-hidden {
    display: none;
  }
}

.app-tabbar > .app-icon {
  flex: 1 1 0;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem; /* room for the ring round the active icon */
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.72rem;
  line-height: 1.1;
  color: var(--app-nav-fg, var(--bs-body-color));
  text-decoration: none;
}

.app-tabbar > .app-icon::before {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  background-size: 1.1rem;
  opacity: 0.7;
}

.app-tabbar > .app-icon.active {
  font-weight: 600;
}

.app-tabbar > .app-icon.active::before {
  opacity: 1;
  box-shadow: 0 0 0 1.5px var(--app-nav-bg, var(--bs-body-bg)), 0 0 0 3px var(--nav-color);
}

/* The "Mer" sheet: every page as a big tile */
.app-sheet.offcanvas-bottom {
  height: auto;
  max-height: 85vh;
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
  padding-bottom: env(safe-area-inset-bottom);
}

.app-sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 0.5rem;
}

.app-sheet-grid .app-icon {
  width: 100%;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.25rem;
  border: 0;
  border-radius: 0.75rem;
  background: none;
  font-size: 0.85rem;
  color: var(--bs-body-color);
  text-decoration: none;
  text-align: center;
}

.app-sheet-grid .app-icon.active {
  background: var(--bs-tertiary-bg);
  font-weight: 600;
}

.app-sheet-grid .app-icon::before {
  width: 3rem;
  height: 3rem;
  border-radius: 0.8rem;
  background-size: 1.75rem;
}

/* Start page: each card's heading is a link to its page, with the page's menu icon */
.dash-title {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.dash-title::before {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.45rem;
  background-size: 1rem;
}

.dash-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

/* Big enough to hit with a thumb: Apple recommends at least 44 × 44 px on touch screens */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: -0.25rem -0.5rem -0.25rem 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--bs-secondary-color);
}

.icon-btn:hover {
  background: var(--bs-tertiary-bg);
}

@media (pointer: coarse) {
  .icon-btn {
    width: 44px;
    height: 44px;
    margin-top: -0.6rem;
    margin-bottom: -0.6rem;
  }
}

/* Tick boxes in lists (Uppgifter, Inköpslista, Checklistor): bigger, and the whole row ticks */
.list-check {
  width: 1.4em;
  height: 1.4em;
  margin-top: 0 !important;
  cursor: pointer;
}

.list-group-item label {
  cursor: pointer;
}

.min-w-0 {
  min-width: 0;
}

/* Fold-out panels whose heading looks like a button: Dokument's upload form and the
   search boxes on Utgifter and Dokument (closed unless a search is active) */
.fold > summary {
  display: inline-block;
  list-style: none;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold[open] > summary {
  margin-bottom: 0.5rem;
}

/* "Laddar…" / "Väcker stugan…" notice while a slow page loads (site.js) */
.app-loading {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h, 0px) + 1rem);
  transform: translateX(-50%);
  z-index: 1090;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: max-content;
  max-width: calc(100vw - 2rem);
  padding: 0.6rem 1rem;
  border-radius: 0.75rem;
  background: var(--bs-emphasis-color);
  color: var(--bs-body-bg);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
  font-size: 0.9rem;
}

.app-loading[hidden] {
  display: none;
}

/* Symbols for the round icon buttons, drawn in the text colour */
.icon-edit::before,
.icon-download::before {
  content: "";
  width: 1.1rem;
  height: 1.1rem;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.icon-edit {
  --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 20h4L19 9l-4-4L4 16z'/><path d='m13.5 6.5 4 4'/></svg>");
}

.icon-download {
  --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 4v11'/><path d='m7 10 5 5 5-5'/><path d='M5 20h14'/></svg>");
}

/* Side menu: signed in on a computer (992px and wider) the menu bar becomes a column fixed to
   the left edge, so every page gets a full row with room to breathe. Phones keep the tab bar,
   and tablets the ☰ menu. The markup is the same menu bar (_Layout.cshtml); only CSS moves it. */
@media (min-width: 992px) {
  body.has-tabbar {
    --sidebar-w: 14.5rem;
    padding-left: var(--sidebar-w);
  }

  .has-tabbar .app-navbar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    width: var(--sidebar-w);
    margin: 0 !important;
    padding: 0;
    align-items: stretch;
    border-bottom: 0 !important;
    border-right: 1px solid var(--bs-border-color);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .has-tabbar .app-navbar > .container {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    max-width: none;
    min-height: 100%;
    padding: 1.25rem 0.75rem 1rem;
  }

  .has-tabbar .app-menu-toggle {
    display: none;
  }

  .has-tabbar .app-navbar .navbar-brand {
    margin: 0 0 1.25rem !important;
    padding: 0 0.75rem;
    font-size: 1.4rem;
    font-weight: 600;
    text-align: left;
  }

  /* Always open, and the profile and Logga ut sit at the bottom of the column */
  .has-tabbar .app-navbar .navbar-collapse {
    display: flex !important;
    flex-direction: column;
    flex-grow: 1;
    align-items: stretch;
  }

  .has-tabbar .app-navbar .navbar-nav {
    flex-direction: column;
    flex-grow: 0;
    align-items: stretch !important;
    gap: 0.15rem;
  }

  .has-tabbar .app-navbar .navbar-nav:last-child {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--bs-border-color);
  }

  .has-tabbar .app-navbar .nav-link {
    gap: 0.75rem;
    width: 100%;
    padding: 0.45rem 0.75rem;
    border-radius: 0.6rem;
    text-align: left;
  }

  .has-tabbar .app-navbar .nav-link::before {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.45rem;
    background-size: 1.1rem;
  }

  .has-tabbar .app-navbar .nav-link:hover {
    background: rgba(128, 128, 128, 0.12);
  }

  .has-tabbar .app-navbar .nav-link.active {
    background: rgba(128, 128, 128, 0.2);
    font-weight: 600;
  }

  /* The menu bar no longer pushes the page down, so give the page its own space at the top */
  body.has-tabbar > .container {
    padding-top: 1.75rem;
  }

  /* The picture lines up with the icon tiles above it */
  .has-tabbar .app-navbar .avatar {
    width: 1.75rem;
    height: 1.75rem;
  }
}

/* In a low window (a laptop with big text, say) the side menu gets tighter so it still fits
   without a scrollbar of its own next to the page's scrollbar */
@media (min-width: 992px) and (max-height: 720px) {
  .has-tabbar .app-navbar > .container {
    padding-top: 0.75rem;
    padding-bottom: 0.5rem;
  }

  .has-tabbar .app-navbar .navbar-brand {
    margin-bottom: 0.5rem !important;
    font-size: 1.25rem;
  }

  .has-tabbar .app-navbar .navbar-nav {
    gap: 0;
  }

  .has-tabbar .app-navbar .nav-link {
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
  }

  .has-tabbar .app-navbar .nav-link::before,
  .has-tabbar .app-navbar .avatar {
    width: 1.5rem;
    height: 1.5rem;
    background-size: 0.95rem;
  }

  .has-tabbar .app-navbar .navbar-nav:last-child {
    padding-top: 0.4rem;
  }
}

/* File viewer (_FileViewer.cshtml): documents and receipts open inside the app, with the
   Tillbaka bar kept in view while scrolling through a long PDF. */
.file-viewer-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
}

.file-viewer-bar .btn {
  white-space: nowrap;
}

.file-viewer-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
}

.file-viewer-pdf canvas {
  display: block;
  width: 100%;
  max-width: 860px;
  height: auto;
  margin: 0 auto 0.75rem;
  border: 1px solid var(--bs-border-color);
  background: #fff;
}

.file-viewer-text {
  white-space: pre-wrap;
  word-break: break-word;
  padding: 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  font-size: 0.9rem;
}
