/* Menu icons: a small coloured tile with a white symbol before each menu item.
   The icons are matched on the link's address (the one in the page's @page line, e.g. "/Chatt"),
   so the menu markup needs no changes. Other links with class "app-icon" (the phone tab bar,
   the "Mer" sheet and the start page card headings) get the same icons.
   To give a new page an icon, add one rule at the bottom:
     :is(.app-navbar .nav-link, .app-icon)[href="/NewPage"] { --nav-tile: ""; --nav-color: #…; --nav-icon: url("data:image/svg+xml,…"); }
   Pick a mid-tone colour that white shows up on (the symbols are white, drawn on a 24×24 grid). */

.app-navbar .nav-link,
.app-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --nav-tile is only set (to "") by the rules below, so links without an icon get none */
.app-navbar .nav-link::before,
.app-icon::before {
  content: var(--nav-tile, none);
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: var(--nav-color) var(--nav-icon) center / 1.2rem no-repeat;
}

/* Computer, before signing in: the few menu items sit in one row at the top, with smaller tiles.
   Signed in, computers get the side menu instead (see "Side menu" in site.css). */
@media (min-width: 1200px) {
  body:not(.has-tabbar) .app-navbar .navbar-nav .nav-link {
    gap: 0.3rem;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  body:not(.has-tabbar) .app-navbar .nav-link::before {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 0.35rem;
    background-size: 0.9rem;
  }

  body:not(.has-tabbar) .app-navbar .navbar-brand {
    margin-right: 0.75rem;
  }
}

/* On the green and red menu bars a thin light edge keeps a same-coloured tile visible */
html[data-scheme="granris"] .app-navbar .nav-link::before,
html[data-scheme="branntunna"] .app-navbar .nav-link::before {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
}

/* Hem */
:is(.app-navbar .nav-link, .app-icon)[href="/"] {
  --nav-tile: "";
  --nav-color: #d0503c;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 11.5 12 4l9 7.5'/><path d='M5.5 10v10h13V10'/><path d='M10 20v-5.5h4V20'/></svg>");
}

/* Utgifter */
:is(.app-navbar .nav-link, .app-icon)[href="/Expenses"] {
  --nav-tile: "";
  --nav-color: #2f8a4e;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='6' width='18' height='13' rx='2'/><path d='M3 10h18'/><path d='M15.5 14.5h2'/></svg>");
}

/* Kalender */
:is(.app-navbar .nav-link, .app-icon)[href="/Visits"] {
  --nav-tile: "";
  --nav-color: #2a6fd1;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><rect x='3.5' y='5' width='17' height='15.5' rx='2'/><path d='M3.5 10h17'/><path d='M8 3v4M16 3v4'/></svg>");
}

/* Uppgifter */
:is(.app-navbar .nav-link, .app-icon)[href="/Tasks"] {
  --nav-tile: "";
  --nav-color: #c76a12;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M13 4.5 19.5 11'/><path d='M10.5 7l4.5-4.5 4.5 4.5-4.5 4.5z'/><path d='M12.5 9.5 4 18l2 2 8.5-8.5'/></svg>");
}

/* Checklistor */
:is(.app-navbar .nav-link, .app-icon)[href="/Checklistor"] {
  --nav-tile: "";
  --nav-color: #128a86;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='m3.5 6.5 1.8 1.8L8.5 5'/><path d='m3.5 13.5 1.8 1.8L8.5 12'/><path d='M12 7h8.5M12 14h8.5M5 20h15.5'/></svg>");
}

/* Inköpslista */
:is(.app-navbar .nav-link, .app-icon)[href="/Inkopslista"] {
  --nav-tile: "";
  --nav-color: #a5800f;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M2.5 4h2.5l2.3 10.5h10.8L20.5 7.5H6'/><circle cx='9' cy='19' r='1.4'/><circle cx='17' cy='19' r='1.4'/></svg>");
}

/* Stugpärm */
:is(.app-navbar .nav-link, .app-icon)[href="/Stugparm"] {
  --nav-tile: "";
  --nav-color: #8b5a3c;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 5a2 2 0 0 1 2-2h12v15H7a2 2 0 0 0-2 2z'/><path d='M5 20a2 2 0 0 0 2 1h12v-3'/><path d='M9.5 8h5'/></svg>");
}

/* Dokument */
:is(.app-navbar .nav-link, .app-icon)[href="/Dokument"] {
  --nav-tile: "";
  --nav-color: #5b55d6;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 3h8l5 5v13H6z'/><path d='M14 3v5h5'/><path d='M9 13h7M9 17h7'/></svg>");
}

/* Chatt */
:is(.app-navbar .nav-link, .app-icon)[href="/Chatt"] {
  --nav-tile: "";
  --nav-color: #c23f86;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 5h16v11H10l-5 4v-4H4z'/></svg>");
}

/* Admin */
:is(.app-navbar .nav-link, .app-icon)[href="/Admin"] {
  --nav-tile: "";
  --nav-color: #475467;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3 19.5 6v5.5c0 4.6-3.2 7.8-7.5 9.5-4.3-1.7-7.5-4.9-7.5-9.5V6z'/><path d='m9 12 2 2 4-4'/></svg>");
}

/* Logga ut (a button in a form, so it has no address) */
:is(.app-navbar form .nav-link, .app-icon-logout) {
  --nav-tile: "";
  --nav-color: #6b7280;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M10 4H5v16h5'/><path d='m15 8 4 4-4 4'/><path d='M19 12H9.5'/></svg>");
}

/* Skapa konto (before signing in) */
:is(.app-navbar .nav-link, .app-icon)[href="/Identity/Account/Register"] {
  --nav-tile: "";
  --nav-color: #2f8a4e;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='10' cy='8' r='3.5'/><path d='M3.5 20c.5-3.6 3.2-6 6.5-6s6 2.4 6.5 6'/><path d='M19 8v6M16 11h6'/></svg>");
}

/* Logga in (before signing in) */
:is(.app-navbar .nav-link, .app-icon)[href="/Identity/Account/Login"] {
  --nav-tile: "";
  --nav-color: #2a6fd1;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M14 4h5v16h-5'/><path d='m9 8 4 4-4 4'/><path d='M13 12H3.5'/></svg>");
}

/* Mer (the phone tab bar's button that opens the sheet with every page) */
.app-icon-more {
  --nav-tile: "";
  --nav-color: #6b7280;
  --nav-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><circle cx='5.5' cy='12' r='2'/><circle cx='12' cy='12' r='2'/><circle cx='18.5' cy='12' r='2'/></svg>");
}

/* Min profil in the sheet: the person's own picture (set on the link) instead of a symbol */
.app-icon-profile {
  --nav-tile: "";
  --nav-color: transparent;
}

.app-icon-profile::before {
  border-radius: 50% !important;
  background-size: cover !important;
}
