/* NP Telefonist – gemensam stilmall (profil C "Skandinavisk skog", 1.66.0). Mobil först. Färger som variabler; mörkt läge följer telefonen.
   Varumärke: Nord Properties AB (grön #a0ce4e och turkos #7abdc0 från nordproperties.se). Skogsgrön text/knapp (--brand-ink),
   mörk skogsgrön sidhuvud i båda lägena (--topbar-*), varumärkesgrönt används bara dekorativt och i sidhuvudets aktiva flik.
   Kontrast (WCAG AA) kontrollerad för alla text-/bakgrundspar. Rörelse: --dur (200 ms) och --ease. */

@font-face {
  font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  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: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;
  --bg: #eceee8;            /* svagt grönaktig bas */
  --surface: #fbfcf9;
  --surface-2: #f3f5ef;
  --line: #d5dacf;          /* dekorativa linjer */
  --line-strong: #7b8574;   /* fältkanter, minst 3:1 */
  --text: #141d17;
  --muted: #4d5a50;
  --brand: #a0ce4e;         /* Nord Properties grön, bara dekor */
  --brand-ink: #2c5a1c;     /* skogsgrön som text/knapp */
  --brand-hover: #234a15;
  --brand-soft: #e3efd2;
  --brand-soft-ink: #234a15;
  --on-brand: #ffffff;
  --teal: #7abdc0;
  --teal-soft: #dcefef;
  --teal-ink: #1d5f63;
  --danger-ink: #a61e0c;
  --danger-soft: #fbe8e4;
  --warn-ink: #8a4004;
  --warn-soft: #fcefdc;
  --low-ink: #4f5a52;
  --low-soft: #e4e8df;
  --focus: #1d5f63;
  --shadow: 0 1px 2px rgba(20, 29, 23, .08), 0 4px 12px rgba(20, 29, 23, .05);
  --shadow-raise: 0 6px 18px rgba(20, 29, 23, .12);
  --shadow-pop: 0 16px 40px rgba(10, 20, 14, .22);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  /* 1.64.0: typografisk skala (13, 14, 16, 18, 24, 32 px) och avståndsskala (4 px-steg); inget under 13 px */
  /* 1.66.0: h1 28 px (1.75rem) och stora nyckeltal 32 px (2rem) ingår i skalan */
  --fs-1: .8125rem; --fs-2: .875rem; --fs-3: 1rem; --fs-4: 1.125rem; --fs-5: 1.5rem; --fs-h1: 1.75rem; --fs-h2: 1.25rem; --fs-6: 2rem;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --dur: 200ms;
  --ease: cubic-bezier(.2, .6, .2, 1);
  /* knappar: sekundära är tonade med svag kant */
  --btn-tonal: #dfe4d8;
  --btn-tonal-hover: #d2d9c9;
  --btn-edge: rgba(20, 29, 23, .14);   /* svag kant så att knappen syns mot kort och sida */
  /* prioritet som fylld märkning (vit text, minst 4,5:1) */
  --prio-akut: #a61e0c;
  --prio-hog: #8a4004;
  --on-prio: #ffffff;
  /* testmärkning och bildvisare */
  --test-soft: #fff3c4;
  --test-ink: #5a4300;
  --overlay: rgba(10, 16, 12, .97);
  --on-overlay: #eceee8;
  --on-overlay-link: #a0ce4e;
  /* 1.66.0: sidhuvudet är mörk skogsgrön i båda lägena */
  --topbar-bg: rgba(19, 33, 26, .94);
  --topbar-ink: #e9f0e6;
  --topbar-muted: #b9c7bc;
  --topbar-active: #a8d655;
  --logo: url("logo.png");
  --logo-topbar: url("logo-ljus.png");
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1410;
    --surface: #141d18;
    --surface-2: #1a2520;
    --line: #3a4f42;
    --line-strong: #6a806f;
    --text: #e9f0e6;
    --muted: #a3b2a6;
    --brand-ink: #a8d655;
    --brand-hover: #bde26d;
    --brand-soft: #1f3112;
    --brand-soft-ink: #c9ea94;
    --on-brand: #0f1a06;
    --teal-soft: #16302f;
    --teal-ink: #93d3d6;
    --danger-ink: #f5a79e;
    --danger-soft: #3a1d19;
    --warn-ink: #f3bb7d;
    --warn-soft: #372919;
    --low-ink: #b5c1b8;
    --low-soft: #222e27;
    --focus: #93d3d6;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .05), 0 2px 6px rgba(0, 0, 0, .55);
    --shadow-raise: 0 6px 18px rgba(0, 0, 0, .6);
    --logo: url("logo-ljus.png");
    --btn-tonal: #243229;
    --btn-tonal-hover: #2d3d32;
    --btn-edge: rgba(255, 255, 255, .12);
    --prio-akut: #b8321f;
    --prio-hog: #a3500a;
    --test-soft: #4a3b0a;
    --test-ink: #ffe08a;
    --shadow-pop: 0 16px 40px rgba(0, 0, 0, .6);
  }
}

/* ---------------------------------------------------------------- bas */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }  /* 1.64.0: hidden vinner över komponentklasser (t.ex. .check) */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 420 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 680; letter-spacing: -.015em; }
h1 { font-size: var(--fs-h1); line-height: 1.2; font-weight: 740; letter-spacing: -.02em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-3); font-weight: 660; }
p { margin: 0 0 .75rem; }
a { color: var(--brand-ink); text-underline-offset: 2px; }
small, .muted { color: var(--muted); }
.small { font-size: var(--fs-2); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- sidhuvud */
.topbar { background: var(--topbar-bg); color: var(--topbar-ink); border-bottom: 1px solid color-mix(in srgb, var(--topbar-ink) 12%, transparent); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1400px; margin: 0 auto; padding: 4px 12px; display: flex; align-items: center; gap: 10px; }
.logo { display: block; width: 104px; height: 38px; background: var(--logo) left center / contain no-repeat; flex: none; }
.app-name { display: none; color: var(--topbar-muted); font-size: var(--fs-1); border-left: 1px solid var(--topbar-muted); padding-left: 12px; line-height: 1.2; flex: none; }
.nav { margin-left: auto; }
.nav-menu, .drop { list-style: none; margin: 0; padding: 0; }
.nav a, .nav button.link {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font: inherit; font-weight: 500; background: none; border: 0; cursor: pointer; width: 100%; text-align: left;
}
.nav a:hover, .nav button.link:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--brand-ink); background: var(--brand-soft); }
/* 1.66.0: sidhuvudet är mörkt i båda lägena (alltid ljus logotyp); nedfällda paneler är ytor och behåller vanlig text */
.topbar .logo { background-image: var(--logo-topbar); }
.topbar .nav-desktop > li > a, .topbar .nav summary { color: var(--topbar-ink); }
.topbar .nav-desktop > li > a:hover, .topbar .nav summary:hover, .topbar .nav-drop[open] > summary, .topbar .nav-mobile[open] > summary {
  background: color-mix(in srgb, var(--topbar-ink) 12%, transparent); }
.topbar .nav-desktop > li > a[aria-current="page"], .topbar .nav summary.has-current {
  color: var(--topbar-active); background: color-mix(in srgb, var(--topbar-active) 16%, transparent); }
.topbar .nav-mobile > summary { border-color: var(--topbar-muted); }
.topbar .quick-logout .logout { background: transparent; border-color: var(--topbar-muted); color: var(--topbar-ink); }
.topbar .quick-logout .logout:hover { background: color-mix(in srgb, var(--topbar-ink) 12%, transparent); }
.topbar :focus-visible { outline-color: var(--topbar-active); }
.topbar .drop :focus-visible, .topbar .nav-menu :focus-visible { outline-color: var(--focus); }
.nav form { margin: 0; }
.nav-desktop { display: none; }
.nav summary {
  list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; cursor: pointer; font-weight: 500;
  border-radius: var(--radius-sm);
}
.nav summary::-webkit-details-marker { display: none; }
.nav-mobile > summary { border: 1px solid var(--line-strong); border-radius: var(--radius-pill); }
.nav-mobile[open] > summary, .nav-drop[open] > summary { background: var(--surface-2); }
.nav-mobile > .nav-menu {
  position: absolute; right: 12px; left: 12px; top: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow-pop); max-height: calc(100vh - 80px); overflow-y: auto;
}
.nav-sep { padding: 10px 12px 4px; margin-top: 6px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-1); font-weight: 600; }
.uname { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sep { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-logout { margin: 0; flex: none; }
.quick-logout .logout { min-height: 44px; gap: 6px; }
.nav summary:hover, .nav-drop[open] > summary { background: var(--surface-2); }
.nav summary.has-current { color: var(--brand-ink); background: var(--brand-soft); }
@media (min-width: 600px) { .app-name { display: block; } }
@media (min-width: 1024px) {
  .nav-mobile, .quick-logout { display: none; }
  .nav-desktop { display: flex; align-items: center; gap: 2px; }
  .nav-desktop > li > a { white-space: nowrap; padding: 0 10px; font-size: var(--fs-3); }
  .nav-desktop summary { white-space: nowrap; padding: 0 10px; font-size: var(--fs-3); }
  .nav-drop { position: relative; }
  .drop { position: absolute; top: 100%; right: 0; min-width: 210px; z-index: 20; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow-pop); }
  .topbar-inner { padding: 4px 24px; }
  .logo { width: 120px; height: 42px; }
}

/* ---------------------------------------------------------------- layout */
.page { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head p { margin: 4px 0 0; }
.crumb { display: inline-flex; gap: 6px; align-items: center; font-size: var(--fs-2); color: var(--muted); text-decoration: none; margin-bottom: 8px; }
.crumb:hover { color: var(--text); }
.stack > * + * { margin-top: 16px; }
.grid-2 { display: flex; flex-direction: column; gap: 16px; }
.grid-2 > .col { display: contents; }
.o0 { order: 0; } .o1 { order: 1; } .o2 { order: 2; } .o3 { order: 3; } .o4 { order: 4; } .o5 { order: 5; } .o6 { order: 6; } .o7 { order: 7; }
@media (min-width: 900px) {
  .page { padding: 28px 24px 64px; }
  .grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
  .grid-2 > .col { display: flex; flex-direction: column; gap: 16px; }
}
.footer { max-width: 1200px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: var(--fs-1); }
@media (min-width: 900px) { .footer { padding: 0 24px 40px; } }

/* ---------------------------------------------------------------- kort och sektioner */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { padding: 20px; }
.section > h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.section > h2 .count { color: var(--muted); font-weight: 500; }
@media (min-width: 900px) { .section { padding: 20px 24px; } }
.card.highlight { border-color: var(--brand-ink); box-shadow: 0 0 0 1px var(--brand-ink) inset, var(--shadow); }
.facts { display: grid; grid-template-columns: 1fr; gap: 10px 20px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: var(--fs-1); color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 600px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.facts .wide { grid-column: 1 / -1; }
.missing { color: var(--danger-ink); font-weight: 600; }

/* ---------------------------------------------------------------- nyckeltal */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpis > .kpi:first-child { grid-column: 1 / -1; }  /* 1.11.0: fem kort, Öppna över hela bredden på mobil */
/* 1.64.0: ärendelistans nyckeltal (nav.kpis) som en rullbar rad på mobil, så att listan börjar högre upp */
nav.kpis { display: flex; overflow-x: auto; scrollbar-width: none; gap: var(--space-2); margin-inline: -16px; padding: 2px 16px 4px; }
nav.kpis::-webkit-scrollbar { display: none; }
nav.kpis > .kpi { flex: 0 0 auto; min-width: 104px; padding: 10px 14px; }
nav.kpis > .kpi .n { font-size: var(--fs-5); }
@media (min-width: 700px) { .kpis, nav.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-inline: 0; padding: 0; overflow: visible; }
  .kpis > .kpi:first-child { grid-column: auto; } nav.kpis > .kpi { padding: 14px 16px; } nav.kpis > .kpi .n { font-size: var(--fs-6); } }
.kpi {
  display: block; padding: 14px 16px; text-decoration: none; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); position: relative;
}
.kpi:hover { border-color: var(--line-strong); box-shadow: var(--shadow-raise); }
.kpi .n { display: block; font-size: var(--fs-6); font-weight: 680; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { display: block; font-size: var(--fs-2); color: var(--muted); margin-top: 2px; }
.kpi.on { border-color: var(--brand-ink); box-shadow: 0 0 0 1px var(--brand-ink) inset; background: var(--brand-soft); }
.kpi.on .l { color: var(--brand-soft-ink); }
.kpi.alert .n { color: var(--danger-ink); }
.kpi.wait .n { color: var(--teal-ink); }
.kpi.zero .n { color: var(--muted); }

/* ---------------------------------------------------------------- chips (filter) */
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); color: var(--text); background: var(--surface); text-decoration: none;
  font-size: var(--fs-2); font-weight: 500; white-space: nowrap;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-current="true"] { background: var(--brand-ink); border-color: var(--brand-ink); color: var(--on-brand); }
.chip svg { width: 16px; height: 16px; flex: none; }
.chip .n { color: inherit; opacity: .7; font-variant-numeric: tabular-nums; }
.chip-label { font-size: var(--fs-1); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); align-self: center; margin-right: 2px; }
/* sorteringsväljaren i listorna (1.34.0) */
.sort { display: flex; align-items: center; gap: 8px; }
.sort label { flex: none; font-size: var(--fs-2); font-weight: 600; color: var(--muted); }
.sort select { flex: 1 1 auto; width: auto; min-width: 0; min-height: 44px; padding: 6px 10px; }
.sort button[hidden] { display: none; }
@media (min-width: 900px) { .sort select { flex: 0 1 auto; } }

/* ---------------------------------------------------------------- etiketter */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--radius-pill); font-size: var(--fs-1);
  font-weight: 600; line-height: 1.5; white-space: nowrap; background: var(--low-soft); color: var(--low-ink);
}
.tag svg { width: 14px; height: 14px; flex: none; }
.tag.akut { background: var(--danger-soft); color: var(--danger-ink); }
.tag.hog { background: var(--warn-soft); color: var(--warn-ink); }
/* 1.64.0: ärendets prio (prio_tag) som fylld märkning */
.tag[data-prio].akut { background: var(--prio-akut); color: var(--on-prio); }
.tag[data-prio].akut::before { content: "▲" / ""; font-size: .7em; }
.tag[data-prio].hog { background: var(--prio-hog); color: var(--on-prio); }
.tag.normal { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.tag.lag { background: var(--low-soft); color: var(--low-ink); }
/* 1.64.0: status som punkt och text (skiljs från prio även utan färgseende) */
.tag.ny { background: var(--teal-soft); color: var(--teal-ink); }
.tag.pagar { background: var(--brand-soft); color: var(--brand-soft-ink); }
.tag.klar { background: var(--low-soft); color: var(--low-ink); }
.tag[data-status] { background: transparent; padding-left: 0; padding-right: 0; }
.tag[data-status]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.tag[data-status].pagar { color: var(--brand-ink); }
.tag.wait { background: var(--teal-soft); color: var(--teal-ink); }
.tag.test { background: var(--test-soft); color: var(--test-ink); }
.type { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--muted); font-size: var(--fs-2); }
/* 1.66.0: typikonen i en 36 px rundad bricka */
.type svg { width: 36px; height: 36px; padding: 9px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-ink); flex: none; }
.due { font-size: var(--fs-2); color: var(--muted); font-variant-numeric: tabular-nums; }
.due.late { color: var(--danger-ink); font-weight: 600; }
.due.paused { color: var(--teal-ink); }
.warn-text { color: var(--warn-ink); font-weight: 600; }

/* ---------------------------------------------------------------- ärendelistan: kort på mobil, tabell på dator */
.tickets { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tickets .head { display: none; }
.ticket {
  display: grid; gap: 6px 12px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "ref prio" "main main" "type type" "status status" "due due";
}
.ticket > .c-ref { grid-area: ref; display: flex; align-items: baseline; gap: 8px; }
.ticket > .c-prio { grid-area: prio; justify-self: end; }
.ticket > .c-main { grid-area: main; min-width: 0; }
.ticket > .c-type { grid-area: type; }
.ticket > .c-status { grid-area: status; justify-self: end; text-align: right; }
.ticket > .c-due { grid-area: due; }
.ticket > .c-due:empty { display: none; }
.ticket.is-akut { border-left: 4px solid var(--danger-ink); }
.ticket .ref { font-weight: 650; text-decoration: none; color: var(--text); font-variant-numeric: tabular-nums; }
.ticket .ref::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); } /* hela kortet klickbart */
.ticket .when { color: var(--muted); font-size: var(--fs-1); font-variant-numeric: tabular-nums; }
.ticket .summary { font-weight: 500; }
.ticket .where { color: var(--muted); font-size: var(--fs-2); overflow-wrap: anywhere; }
.ticket .sub { display: block; color: var(--muted); font-size: var(--fs-1); margin-top: 3px; }
@media (min-width: 900px) {
  .tickets { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
  .tickets .head, .ticket {
    grid-template-columns: 128px 84px minmax(0, 2.4fr) minmax(0, 1.1fr) minmax(0, 1.3fr) minmax(0, 1.2fr);
    grid-template-areas: "ref prio main type status due"; align-items: center; gap: 16px;
    padding: 14px 20px; border: 0; border-radius: 0; box-shadow: none;
  }
  .tickets .head { display: grid; font-size: var(--fs-1); text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
    background: var(--surface-2); border-bottom: 1px solid var(--line); padding-top: 10px; padding-bottom: 10px; }
  .ticket + .ticket { border-top: 1px solid var(--line); }
  .ticket.is-akut { border-left: 0; box-shadow: inset 4px 0 0 var(--danger-ink); }
  .ticket:hover { background: var(--surface-2); }
  .ticket > .c-ref { flex-direction: column; gap: 0; }
  .ticket > .c-prio, .ticket > .c-status { justify-self: start; text-align: left; }
  .ticket > .c-due:empty { display: block; }
}

/* ---------------------------------------------------------------- knappar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: var(--radius-sm); border: 1px solid var(--btn-edge); background: var(--btn-tonal); color: var(--text);
  font: inherit; font-weight: 650; font-size: var(--fs-3); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--btn-tonal-hover); }
.btn-primary { background: var(--brand-ink); border-color: var(--brand-ink); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { background: var(--surface); border-color: color-mix(in srgb, var(--danger-ink) 45%, transparent); color: var(--danger-ink); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand-ink); padding: 0 10px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: var(--fs-2); position: relative; }
.btn-sm::after { content: ""; position: absolute; inset: -4px 0; }  /* 1.64.0: mindre knapp, tryckytan är kvar 44 px */
summary { min-height: 44px; padding-block: 10px; box-sizing: border-box; }  /* B3: sammanfällbara rubriker (Visa som tabell, Utlägg) är klickytor på minst 44 px */
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row form { margin: 0; }
form.inline { display: inline; margin: 0; }

/* ---------------------------------------------------------------- formulär */
.form { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .wide { grid-column: 1 / -1; } }
.field { display: grid; gap: 6px; }
.field > span, .field > label, legend { font-size: var(--fs-2); font-weight: 600; }
.field .hint { font-size: var(--fs-1); color: var(--muted); font-weight: 400; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
textarea { min-height: 110px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-size: var(--fs-3); }
.check input { width: 24px; height: 24px; margin: 0; accent-color: var(--brand-ink); flex: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; }
fieldset .check { margin: 6px 0; }
.option { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); align-items: flex-start; }
.option + .option { margin-top: 8px; }
.option:has(input:checked) { border-color: var(--brand-ink); background: var(--brand-soft); }
.option input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand-ink); }

/* ---------------------------------------------------------------- meddelanden */
.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--teal-soft); color: var(--teal-ink); }
.notice.error { background: var(--danger-soft); color: var(--danger-ink); }
.notice.ok { background: var(--brand-soft); color: var(--brand-soft-ink); }
.notice.warn { background: var(--warn-soft); color: var(--warn-ink); }

/* ---------------------------------------------------------------- tidslinje (historik) */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline li.k-skapat::after, .timeline li.k-status::after { border-color: var(--brand-ink); }
.timeline li.k-frist::after { border-color: var(--danger-ink); }
.timeline li.k-aterop::after { border-color: var(--warn-ink, var(--brand-ink)); }
.timeline .t { font-size: var(--fs-1); color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .who { color: var(--muted); font-size: var(--fs-2); }
/* noteringar och meddelanden från entreprenören (1.10.0): egen ikon och tonad bakgrund */
.timeline li.k-notering, .timeline li.k-meddelande, .timeline li.k-fraga { padding: 8px 10px 10px 30px; margin: 0 0 12px; border-radius: var(--radius-sm); }
.timeline li.k-notering { background: var(--brand-soft); }
.timeline li.k-meddelande { background: var(--teal-soft); }
.timeline li.k-fraga { background: var(--surface); border: 1px solid var(--teal); }
.timeline li.k-notering::after, .timeline li.k-meddelande::after, .timeline li.k-fraga::after { display: none; }
.timeline li.k-notering::before, .timeline li.k-meddelande::before, .timeline li.k-fraga::before { left: 12px; top: 30px; }
.k-fraga .note-head { display: block; }  /* rubriken bryts som löptext */
.k-fraga .note-head svg { color: var(--teal-ink); }
/* 1.11.0: svaret på en fråga, indraget under frågan */
.answer { margin: 8px 0 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--teal-soft); }
.answer .t { font-size: var(--fs-1); color: var(--muted); font-variant-numeric: tabular-nums; }
.ask { margin-top: 10px; }
.ask .btn-row { margin-bottom: 8px; }
.ask-box { border: 2px solid var(--teal); }
.ask-box .t { font-size: var(--fs-1); color: var(--muted); margin: 0; font-variant-numeric: tabular-nums; }
.note-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.note-head svg { width: 18px; height: 18px; flex: none; position: absolute; left: 7px; top: 9px; }
.k-notering .note-head svg { color: var(--brand-soft-ink); }
.k-meddelande .note-head svg { color: var(--teal-ink); }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0 4px; }
.tag.shared { background: var(--surface); color: var(--teal-ink); border: 1px solid var(--teal); white-space: normal; max-width: 100%; border-radius: var(--radius-sm); }
.note-form { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
/* 1.11.1: meddelandelogg som chatt (mobilsidan och under Uppdrag på ärendesidan) */
.chat { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chat .msg { max-width: 88%; padding: 8px 12px; border-radius: var(--radius); }
.chat .msg.np { align-self: flex-start; background: var(--brand-soft); border-bottom-left-radius: 4px; }
.chat .msg.np.ask { background: var(--surface); border: 2px solid var(--teal); }
.chat .msg.firm { align-self: flex-end; background: var(--teal-soft); border-bottom-right-radius: 4px; }
.chat .msg.reply { margin-top: -4px; }
.chat .meta { font-size: var(--fs-1); color: var(--muted); font-variant-numeric: tabular-nums; }
.chat .meta b { color: var(--text); font-weight: 600; }
.chat .kind { font-size: var(--fs-1); color: var(--muted); }
.chat .btn-row { margin-top: 4px; }
.chat a.tag { text-decoration: none; }
.chat .hidden-info { font-size: var(--fs-2); color: var(--muted); text-align: center; }
.chat-reply { border-top: 1px solid var(--line); padding-top: 12px; }
details.thread { margin-top: 10px; }
details.thread .chat { margin-top: 8px; }

/* ---------------------------------------------------------------- samtal och hopfällbart */
details.fold > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; flex-wrap: wrap; gap: 0 8px; min-height: 44px; }
details.fold > summary .meta { font-weight: 400; color: var(--muted); font-size: var(--fs-2); flex-basis: 100%; padding-left: 20px; }
@media (min-width: 600px) { details.fold > summary .meta { flex-basis: auto; padding-left: 0; } }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "›"; display: inline-block; transition: transform var(--dur) var(--ease); font-size: 1.3rem; line-height: 1; color: var(--muted); }
details.fold[open] > summary::before { transform: rotate(90deg); }
.bubble { padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); margin: 6px 0; max-width: 46rem; }
.bubble.assistent { background: var(--teal-soft); }
.bubble.system { background: var(--warn-soft); font-style: italic; }
.bubble small { display: block; margin-bottom: 2px; }

/* ---------------------------------------------------------------- kostnadsförslag */
.proposal .sum { font-size: var(--fs-5); font-weight: 650; font-variant-numeric: tabular-nums; }
.proposal .lines { display: grid; grid-template-columns: 1fr auto; row-gap: 4px; margin: 8px 0 12px; font-variant-numeric: tabular-nums; }
.proposal .lines > :nth-child(even) { text-align: right; padding-left: 16px; }
.proposal .lines .total { border-top: 1px solid var(--line); padding-top: 6px; font-weight: 650; }
.photo-thumb { display: inline-block; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.photo-thumb img { display: block; width: 96px; height: 96px; object-fit: cover; }
.decision { display: grid; gap: 10px; margin-top: 12px; }

/* ---------------------------------------------------------------- bilder från kunden (1.29.0) */
.gallery { display: flex; flex-wrap: wrap; gap: 12px; }
.gallery figure { margin: 0; width: 96px; }
.gallery figcaption { font-size: var(--fs-1); color: var(--muted); line-height: 1.3; margin-top: 4px; overflow-wrap: anywhere; }
.lightbox { display: none; }
.lightbox:target { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  position: fixed; inset: 0; z-index: 100; padding: 48px 16px 16px; background: var(--overlay); }
.lightbox img { max-width: 100%; max-height: calc(100vh - 130px); object-fit: contain; border-radius: var(--radius-sm); }
.lightbox p { color: var(--on-overlay); font-size: var(--fs-2); text-align: center; margin: 0; }
.lightbox p a { color: var(--on-overlay-link); }
.lightbox-close { position: absolute; top: 8px; right: 12px; color: var(--on-overlay); font-size: 2rem; line-height: 1;
  text-decoration: none; padding: 4px 10px; }
.lightbox-close:focus-visible { outline: 3px solid var(--on-overlay-link); }
.file-pick { position: relative; gap: 8px; white-space: normal; text-align: center; min-height: 52px; font-size: var(--fs-4); }
.file-pick svg { width: 22px; height: 22px; }
.file-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.file-pick:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.file-count { margin: 6px 0 0; }
@media (min-width: 600px) { .decision .btn-row { flex-wrap: nowrap; } }

/* ---------------------------------------------------------------- tabeller (entreprenörer, samtal) */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-2); }
.table th { text-align: left; font-size: var(--fs-1); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table td { padding: 14px 20px; border-bottom: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
@media (max-width: 699px) {
  .table.stackable thead { display: none; }
  .table.stackable tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table.stackable td { display: block; padding: 2px 0; border: 0; }
  .table.stackable td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: var(--fs-1); }  /* 1.12.0 */
}
.inactive { opacity: .6; }
/* objektsregistret (1c): inmatningsfält i tabellcellerna */
.objekt-tabell td input:not([type=hidden]), .objekt-tabell td select { min-width: 5rem; }
@media (min-width: 700px) {
  .objekt-tabell td select { min-width: 7.5rem; }
  .objekt-tabell td input:not([type=hidden]) { max-width: 6rem; min-width: 3.5rem; }
  .objekt-tabell th, .objekt-tabell td { padding-left: 8px; padding-right: 8px; }
  .objekt-tabell th { letter-spacing: .03em; }
  .objekt-tabell .btn-row { flex-wrap: nowrap; }
  .objekt-tabell td.atgarder { white-space: nowrap; }
}

/* ---------------------------------------------------------------- inloggning */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 400px; padding: 28px 24px; border-radius: var(--radius-lg); box-shadow: var(--shadow-raise); }
.auth .logo { width: 160px; height: 60px; margin: 0 auto 6px; background-position: center; }
.auth h1 { text-align: center; font-size: var(--fs-5); font-weight: 700; color: var(--text); margin-bottom: 22px; }

/* ---------------------------------------------------------------- entreprenörens mobilsida */
.m-page { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }
#fel { scroll-margin-top: 12px; }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.m-head .logo { width: 96px; height: 36px; }
.m-ref { font-size: 1.35rem; font-weight: 650; margin: 0 0 4px; }
.place { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 14px; }
.place > div { margin: 0 0 8px; }
.place small { display: block; color: var(--muted); font-size: var(--fs-1); }
.place b { display: block; font-size: var(--fs-4); font-weight: 650; line-height: 1.25; }
.place > div:first-child b { font-size: var(--fs-5); }
.place b.missing { color: var(--danger-ink); font-weight: 600; }
.place .btn { margin-top: 10px; min-height: 52px; font-size: var(--fs-4); }
.stepper { list-style: none; display: flex; margin: 0 0 16px; padding: 0; counter-reset: s; }
.stepper li { flex: 1; position: relative; text-align: center; font-size: var(--fs-1); color: var(--muted); padding-top: 30px; hyphens: auto; -webkit-hyphens: auto; }
.stepper li::before {
  counter-increment: s; content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-1); font-weight: 700;
  background: var(--surface); border: 2px solid var(--line-strong); color: var(--muted); z-index: 1;
}
.stepper li::after { content: ""; position: absolute; top: 11px; left: -50%; right: 50%; height: 2px; background: var(--line-strong); }
.stepper li:first-child::after { display: none; }
.stepper li.done { color: var(--text); }
.stepper li.done::before { content: "✓"; background: var(--brand-ink); border-color: var(--brand-ink); color: var(--on-brand); }
.stepper li.done::after, .stepper li.current::after { background: var(--brand-ink); }
.stepper li.current { color: var(--text); font-weight: 700; }
.stepper li.current::before { border-color: var(--brand-ink); color: var(--brand-ink); box-shadow: 0 0 0 4px var(--brand-soft); }
.stepper li.skip { color: var(--muted); }
.stepper li small { display: block; font-size: var(--fs-1); color: var(--muted); font-weight: 400; }
.next { padding: 16px; margin-bottom: 14px; }
.next .btn-primary { min-height: 56px; font-size: var(--fs-4); }
.next h2 { margin-bottom: 10px; }
.sum-box { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-soft-ink); }
.sum-box b { font-size: var(--fs-5); font-variant-numeric: tabular-nums; }
.other { margin-top: 10px; }
.m-foot { font-size: var(--fs-1); color: var(--muted); margin-top: 20px; }

/* ---------------------------------------------------------------- 1.7.0: sidkomponenter */
.narrow { max-width: 760px; }
.sub { display: block; color: var(--muted); font-size: var(--fs-1); margin-top: 3px; font-weight: 400; }
ul.plain, .checklist { list-style: none; padding: 0; margin: 0; }
ul.plain li, .checklist li { margin: 3px 0; }
.status-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.status-action form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.status-action .check { font-size: var(--fs-2); max-width: 40rem; }
.page-head h1 .tag { vertical-align: middle; font-size: var(--fs-1); }
.page-head .btn-row { gap: 8px 10px; }
.ticket .actions { position: relative; z-index: 1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ticket .actions:empty { display: none; }
/* 1.63.0: Stäng bara i datorns tabell; i mobilkortet låg den tätt intill Pågår utan bekräftelse */
.ticket .actions .close-action, .ticket .actions.only-close { display: none; }
@media (min-width: 900px) { .ticket .actions .close-action { display: inline; } .ticket .actions.only-close { display: flex; } }

/* ---------------------------------------------------------------- sökfältet i ärendelistan (1.63.0) */
.search { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.search input[type=search] { flex: 1 1 auto; min-width: 0; min-height: 48px; }
.search .btn { flex: none; }
.list-count { margin: 10px 2px 0; }
.ticket.empty { display: block; color: var(--muted); }
.ticket > .c-due { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.ticket .warn-text { font-size: var(--fs-2); }
@media (min-width: 900px) { .ticket > .c-due { flex-direction: column; align-items: flex-start; gap: 4px; } }
.assignment + .assignment { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.assignment ul.plain { margin: 6px 0 10px; }
.assignment .notice { margin: 8px 0; }
.section > .facts + .assignment, .section > .facts + .btn-row { margin-top: 14px; }
.section > .assignment + .btn-row { margin-top: 14px; }
.proposal h3 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: var(--fs-3); margin-bottom: 8px; }
.proposal.block { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.proposal .photo-thumb { margin: 2px 0 8px; }
.prose h1 { font-size: 1.35rem; margin: 0 0 12px; }
.prose h2 { font-size: var(--fs-h2); margin: 22px 0 6px; }
.prose ul { padding-left: 20px; margin: 0; }
#adress { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
#adress > summary { cursor: pointer; color: var(--brand-ink); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
#adress form { margin-top: 6px; }
.option > span { display: block; }
.form fieldset .check, fieldset .check { margin: 6px 0; }
.check small { color: var(--muted); }
.m-head b { display: inline-flex; padding: 2px 9px; border-radius: var(--radius-pill); font-size: var(--fs-1); font-weight: 700;
  background: var(--low-soft); color: var(--low-ink); }
.m-head b.akut { background: var(--prio-akut); color: var(--on-prio); }
.m-head b.hog { background: var(--prio-hog); color: var(--on-prio); }
.m-head b.normal { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.next .notice { margin-bottom: 12px; }
.other { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 16px; margin: 0 0 12px; }
.other[open] { padding-bottom: 16px; }
.mobile .card + .card, .mobile .card + .other, .mobile .stepper + .due { margin-top: 0; }
.mobile .card { margin-bottom: 14px; }
.tag.wrap { white-space: normal; }
.csv { margin: 10px 0 18px; }
.frist { display: grid; gap: 2px; margin: 0 0 14px; }
.stepper li.skip::before { border-style: dashed; }
/* 1.66.0: steget "valfritt" har klassen skip, som också är "Hoppa till innehållet"; nollställ den där */
.stepper li.skip { position: relative; left: auto; top: auto; z-index: auto; padding: 30px 0 0; border-radius: 0; background: none; box-shadow: none; font-weight: inherit; }
.ticket .ref { white-space: nowrap; }
.ticket > .c-ref { flex-wrap: wrap; }
.ticket > .c-type { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.ticket > .c-type .sub { display: inline; margin: 0; }
.ticket > .c-status { justify-self: stretch; text-align: left; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ticket > .c-status .sub { display: inline; margin: 0; }
.ticket > .c-status .actions { margin: 0 0 0 auto; }
@media (min-width: 900px) {
  .ticket > .c-type { display: block; }
  .ticket > .c-type .sub { display: block; margin-top: 3px; }
  .ticket > .c-status { display: block; }
  .ticket > .c-status .sub { display: block; margin-top: 3px; }
  .ticket > .c-status .actions { margin: 8px 0 0; }
}

/* 1.12.0: inaktiv knapp (t.ex. Godkänn över beloppsgränsen, "Kräver admin") */
.btn[disabled], .btn[aria-disabled=true] { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }

/* 1.13.0: visningar – rutnät med dagar och tidsfönster (intressent och visningsvärd), en rad per dag */
.slots { display: grid; gap: 8px; margin: 8px 0 14px; }
@media (min-width: 700px) { .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.slot-day { border: 0; padding: 0; margin: 0; min-width: 0; }
.slot-day legend { font-weight: 650; padding: 0; margin-bottom: 4px; font-size: var(--fs-2); }
.slot-cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center;
  min-height: 56px; padding: 6px 4px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; font-size: var(--fs-2); line-height: 1.2; }
.slot small { color: var(--muted); font-variant-numeric: tabular-nums; font-size: var(--fs-1); }
.slot.check { flex-direction: column; }
.slot input[type=checkbox] { margin: 0 0 2px; }
.slot:has(input:checked) { border-color: var(--brand-ink); box-shadow: 0 0 0 2px var(--brand-ink) inset; background: var(--brand-soft); }
.slot select { width: 100%; min-width: 0; font-size: var(--fs-2); padding: 4px; }
.check.big { min-height: 48px; font-size: var(--fs-4); }
.big-time { font-size: 1.35rem; font-weight: 650; margin: 4px 0 10px; }
.alt { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.alt:first-of-type { border-top: 0; margin-top: 0; }
.listing-desc { margin: 10px 0 0; }
#medarbetare h3 { margin-top: 18px; }
.btn-big { min-height: 60px; font-size: var(--fs-4); margin-bottom: 10px; }  /* 1.14.0: intresse-knapparna */
/* 1.15.0: tidsväljaren för visningar – först dagen, sedan starttiderna i kvartar som knappar */
.m-place { font-weight: 600; margin-top: 2px; }
.pick-count { margin: 6px 0; color: var(--muted); font-size: var(--fs-2); }
.picker { display: grid; gap: 6px; margin-bottom: 14px; }
.pick-day { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.pick-day > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; min-height: 48px;
  padding: 0 12px; }
.pick-day > summary::-webkit-details-marker { display: none; }
.pick-day > summary::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 1.3rem; transition: transform var(--dur) var(--ease); }
.pick-day[open] > summary::after { transform: rotate(90deg); }
.pick-day:has(input:checked) > summary b { color: var(--brand-ink); }
.quarters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 0 10px 12px; }
.quarters .q { display: flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); cursor: pointer; font-variant-numeric: tabular-nums; position: relative; }
.quarters .q input { position: absolute; opacity: 0; pointer-events: none; }
.quarters .q:has(input:checked) { background: var(--brand-ink); border-color: var(--brand-ink); color: var(--on-brand); font-weight: 650; }
.quarters .q:has(input:disabled) { opacity: .4; cursor: not-allowed; }
.quarters .q:has(input:focus-visible) { outline: 3px solid var(--teal); outline-offset: 2px; }
/* 1.17.0: SMS och öppnade länkar i tidslinjerna */
.timeline li.k-sms::after { border-color: var(--teal); }
.timeline li.k-oppnad::after { border-color: var(--brand-ink); background: var(--brand-soft); }
.sms-text > summary { cursor: pointer; color: var(--muted); font-size: var(--fs-2); }
.sms-text pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: var(--fs-2); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; margin: 4px 0 0; }

/* 1.22.0: uppsägningar */
fieldset.form-grid { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 4px; margin: 0; }
fieldset.form-grid > legend { font-weight: 600; padding: 0 6px; }
.pdf-preview { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.sms-preview { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: var(--fs-2); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }

/* 1.24.0: sökandestatistik. Staplar per fastighet i en färg (en serie per diagram, ingen förklaring behövs),
   värdet över stapeln och som verktygstips (<title>), tabellen under för den som vill läsa siffrorna. */
.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.kpis-3 > .kpi:first-child { grid-column: auto; }
.mini-charts { display: grid; grid-template-columns: 1fr; gap: 24px; margin-bottom: 12px; }
@media (min-width: 900px) { .mini-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mini-chart { margin: 0; }
.mini-chart figcaption { font-size: var(--fs-2); font-weight: 600; margin-bottom: 6px; }
.mini-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.mini-chart .bar { fill: var(--brand-ink); }
.mini-chart .bar-g:hover .bar { opacity: .75; }
.mini-chart .hit { fill: transparent; }
.mini-chart .base { stroke: var(--line-strong); stroke-width: 1; }
.mini-chart text { font-size: 13px; fill: var(--muted); text-anchor: middle; font-variant-numeric: tabular-nums; }
.mini-chart .val { fill: var(--text); font-weight: 600; }

/* 1.28.0: nöjdhetsfrågan (/n/), fem knappar i rad som tidsväljarens rutor */
.rating { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.rating legend { font-weight: 650; padding: 0; margin-bottom: 6px; font-size: var(--fs-2); }
.rating-cells { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.rating .slot b { font-size: 1.4rem; line-height: 1.1; }
.rating .slot small { font-size: var(--fs-1); line-height: 1.2; overflow-wrap: anywhere; hyphens: auto; -webkit-hyphens: auto; }

/* 1.30.0: "Tidigare på ärendet" (byte av entreprenör) */
.history h3 { margin: 18px 0 6px; }
.history h3:first-of-type { margin-top: 12px; }
.history h4 { font-size: var(--fs-2); margin: 12px 0 6px; }
.history .gallery { margin: 8px 0 12px; }

/* 1.31.0: entreprenörens bildväljare på /u/ */
.photo-pick { display: grid; gap: 6px; }
.photo-pick .field-label { font-size: var(--fs-2); font-weight: 600; }
.photo-pick .file-count { margin: 0; }

/* 1.37.0: annonsernas tratt (Insikter → Annonser) */
.kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis.kpis-4 > .kpi:first-child { grid-column: auto; }
@media (min-width: 700px) { .kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.funnel li { display: grid; grid-template-columns: 8.5rem auto 1fr; align-items: baseline; gap: 2px 12px; }
.funnel .val { font-variant-numeric: tabular-nums; }
.funnel .funnel-bar { grid-column: 1 / -1; width: 100%; height: 8px; display: block; }
.funnel .track { fill: var(--line); }
.funnel .fill { fill: var(--brand-ink); }

/* 1.38.0: råd per annons */
.advice { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 14px; }
.advice-item { border-left: 3px solid var(--line-strong); padding: 2px 0 2px 12px; }
.advice-item p { margin: 6px 0; }

/* 1.40.0: Hämta data från HomeQ */
.homeq-refresh { align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 14px; }
.homeq-refresh .refresh-msg { font-weight: 600; }
.homeq-last { margin: 0 0 14px; }

/* 1.44.0: tidrapporten (/t/) och debitering */
.time-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.time-rows li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.time-rows li:last-child { border-bottom: 0; }
.time-rows li > div { min-width: 0; overflow-wrap: anywhere; }
input.pin { font-size: 1.6rem; letter-spacing: .5em; text-align: center; max-width: 10rem; }
details.opt { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
details.opt > summary { cursor: pointer; font-weight: 600; }
details.opt[open] > summary { margin-bottom: 10px; }
.h-photos { display: grid; gap: 12px; }
.h-photos figure { margin: 0; }
.h-photos img { width: 100%; height: auto; border-radius: var(--radius-sm); }
.mail-preview { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; margin: 6px 0 10px; }
.time-kpis .kpi .n { font-size: 1.35rem; overflow-wrap: anywhere; }
/* 1.47.0: hyresgästens bilder av lägenheten (/f/ och galleriet Bilder för annons) */
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn-row > .check { flex: 1 1 100%; }
.lb-tips ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 6px; }
.lb-room h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.lb-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.lb-btns .btn { justify-content: center; text-align: center; }
.lb-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 8px; }
.lb-thumb { margin: 0; display: grid; gap: 4px; }
.lb-thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); }
.lb-thumb form { margin: 0; }
.lb-thumb .btn { width: 100%; }
form.lb-up.busy { opacity: .6; pointer-events: none; }
.lb-gallery { list-style: none; margin: 12px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.lb-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; display: grid; gap: 6px; align-content: start; }
.lb-item.vald { border-color: var(--brand-ink); box-shadow: 0 0 0 1px var(--brand-ink) inset; }
.lb-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); }
.lb-actions { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }

/* B2: lugn länkrad i sidhuvudet (högst en primärknapp; övriga val som länkar) */
.head-links { display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: 4px; font-size: var(--fs-3); }
.head-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }
.page-head > div:first-child { min-width: 0; }

/* B5: länksidornas första rubrik är sidans h1 men ser ut som förut; felrutan syns när den får fokus via #fel */
h1.h2-like { font-size: var(--fs-h2); }
.section > h1.h2-like { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.next h1.h2-like { margin-bottom: 10px; }
.notice[tabindex="-1"]:focus, .notice[tabindex="-1"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Omgång 0: låsta åtgärder i ett ofullständigt utkast (synlig förklaring bredvid, inte bara nedtonad) */
.btn-locked, .btn-locked[aria-disabled=true] { background: var(--surface); border-color: var(--line-strong); border-style: dashed; cursor: not-allowed; opacity: 1; filter: none; }
.locked-action { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 8px 8px 0; }
.missing-card h2 { font-size: var(--fs-h2); margin: 0 0 8px; }
.missing-card ul { margin: 0 0 10px 1.2rem; }
.form .field:target { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* Omgång 1: lång exempeltext (importsidan) får egen horisontell rullning i stället för att göra sidan bredare */
.card pre { overflow-x: auto; max-width: 100%; }
details.card > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }

/* omgång 3: Nytt avtal i tre steg */
fieldset.radiogrupp { border: 0; padding: 0; margin: 0; min-width: 0; }
.flode-objekt td[data-label=Objekt]::before { display: none; }
.locked-row { display: block; padding: 4px 0; }
.skapa-rad { padding: 8px 0 0; }
.tag-sokte { font-weight: 700; }
.missing-card li a { display: inline-block; box-sizing: border-box; min-height: 44px; padding: 10px 0; }

/* ---------------------------------------------------------------- 1.64.0: designpaket 2 */
/* "Hoppa till innehållet": syns bara när den får fokus med tangentbordet */
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-pop); font-weight: 600; }
.skip:focus { top: 12px; }
main.page:focus { outline: none; }

/* halvgenomskinligt sidhuvud där webbläsaren klarar oskärpa */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar { background: var(--topbar-bg); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); }
}

/* menyn på dator: Sökande och Insikter under "Mer", appnamnet bara när det finns plats */
@media (min-width: 1024px) and (max-width: 1279px) { .app-name { display: none; } }

/* korta övergångar; avstängda vid "minska rörelse" */
.btn, .chip, .kpi, .ticket, .nav a, .nav summary, .seg a { transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* status som segmentkontroll i ärendelistan */
.chips.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--surface-2);
  border: 1px solid var(--line); max-width: 100%; }
.chips.seg .chip { border: 0; background: transparent; min-height: 40px; border-radius: var(--radius-sm); color: var(--muted); }
.chips.seg .chip:hover { background: var(--btn-tonal); color: var(--text); }
.chips.seg .chip[aria-current="true"] { background: var(--brand-ink); color: var(--on-brand); box-shadow: var(--shadow); font-weight: 650; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-4); }

/* typ, ort och sortering hopfällda under en knapp */
details.filter-fold { flex: 0 0 auto; }
details.filter-fold[open] { flex-basis: 100%; }
details.filter-fold > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: var(--radius-sm); background: var(--btn-tonal); font-weight: 600; font-size: var(--fs-2); cursor: pointer; }
details.filter-fold > summary::-webkit-details-marker { display: none; }
details.filter-fold > summary::after { content: "›"; font-size: 1.2rem; line-height: 1; color: var(--muted); transition: transform var(--dur) var(--ease); }
details.filter-fold[open] > summary::after { transform: rotate(90deg); }
details.filter-fold > summary .n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--radius-pill); background: var(--brand-ink); color: var(--on-brand); font-size: var(--fs-1); }
details.filter-fold .filters { margin: var(--space-3) 0 0; }

/* gemensamt tomt läge: rubrik, förklaring och knapp */
.empty-state { text-align: center; padding: var(--space-6) var(--space-4); color: var(--muted); }
.empty-state h2 { color: var(--text); margin-bottom: var(--space-2); }
.empty-state p { max-width: 42ch; margin: 0 auto var(--space-4); }
.ticket.empty { padding: 0; }

/* "Senaste samtal" hopfällt */
details.card.fold > summary { padding: 16px; }
details.card.fold > summary h2 { font-size: var(--fs-h2); display: flex; gap: 8px; }
details.card.fold > summary .count { color: var(--muted); font-weight: 500; }
details.card.fold > .table-wrap { padding: 0 16px 16px; }
@media (min-width: 900px) { details.card.fold > summary { padding: 18px 22px; } details.card.fold > .table-wrap { padding: 0 22px 20px; } }

/* staplade tabeller som kort på mobil */
@media (max-width: 699px) {
  .table.stackable tbody { display: grid; gap: var(--space-2); }
  .table.stackable tr { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
  .table.stackable tr:last-child { border-bottom: 1px solid var(--line); }
  .table.stackable td:first-child { font-weight: 600; padding-bottom: 4px; }
}

/* "Visa lösenord" */
.show-pw { min-height: 36px; font-size: var(--fs-2); }

/* ---------------------------------------------------------------- 1.65.0: ärendesidan och länksidorna */
/* "Nästa steg" överst på ärendesidan */
.next-step { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-4);
  border: 1.5px solid var(--brand-ink); background: var(--brand-soft); padding: var(--space-5); margin-bottom: var(--space-4); }
.next-step.waiting { border-color: var(--teal); background: var(--teal-soft); }
/* 1.66.0: Nästa steg är det stora kortet: rubrik 20 px (inte versaler), knapp 52 px */
.next-step > div:first-child > h2.eyebrow { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -.01em; text-transform: none; color: var(--brand-soft-ink); }
.next-step.waiting > div:first-child > h2.eyebrow { color: var(--teal-ink); }
.next-step .btn-primary { min-height: 52px; }
.next-step.waiting p, .next-step p { color: var(--text); }
.next-step p { margin: 2px 0 0; font-weight: 600; }
.next-step > div:first-child { flex: 1 1 18rem; min-width: 0; }
.eyebrow { font-size: var(--fs-1); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.section > h2.eyebrow { margin: 0; }
/* högst tre märkningar i ärendets rubrik, resten hopfällt */
details.more-tags { display: inline-block; }
details.more-tags > summary { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border-radius: var(--radius-pill);
  font-size: var(--fs-1); font-weight: 600; color: var(--muted); cursor: pointer; list-style: none; border: 1px dashed var(--line-strong); }
details.more-tags > summary::-webkit-details-marker { display: none; }
details.more-tags[open] > summary { margin-bottom: var(--space-2); }
/* kostnadsförslag: orsaken till att Godkänn är avstängd syns som text */
.btn-row > .hint-block { flex: 1 1 100%; margin: 0; color: var(--muted); }
/* länksidor: Nej tack är en lättare knapp med luft till Ja */
.btn-quiet { background: transparent; border-color: var(--line-strong); color: var(--text); font-weight: 500; margin-top: var(--space-4); }
/* länksidor: större rubriker och mer luft */
.mobile .m-page { padding: var(--space-5) var(--space-4) 48px; }
.mobile .m-ref { font-size: var(--fs-5); }
.mobile .section > h2, .mobile .next > h2, .mobile .section > h1.h2-like, .mobile .next > h1.h2-like { font-size: var(--fs-h2); }
.mobile .card { margin-bottom: var(--space-4); }
.mobile .m-head { margin-bottom: var(--space-5); }
/* 1.62.0: märkning av dev-miljön (bara när APP_MILJO=dev), överst på varje sida */
.dev-banner { position: sticky; top: 0; z-index: 100; padding: 6px 12px; background: var(--warn-soft); color: var(--warn-ink);
  border-bottom: 2px solid var(--warn-ink); font-weight: 700; font-size: 14px; text-align: center; }

/* Fel per fält (1.67.0): text under fältet, markerat fält och sammanfattning med länkar överst. */
.field-wrap { display: grid; gap: 6px; }
.field-error { margin: 0; padding: 6px 10px; border-left: 3px solid var(--danger-ink); border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger-ink); font-size: var(--fs-2); font-weight: 600; }
.field [aria-invalid="true"], .check [aria-invalid="true"] { outline: 2px solid var(--danger-ink); outline-offset: 1px; }
.form-grid .field-wrap.wide { grid-column: 1 / -1; }
.error-summary ul { margin: 6px 0 0; padding-left: 20px; }
.error-summary a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ---------------------------------------------------------------- startsidan Idag (1.68.0) */
.section-title { margin: var(--space-5) 0 var(--space-3); }
.section > h3 { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.section > h3 .count { color: var(--muted); font-weight: 500; }
.today-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.today-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-4); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.today-row.is-akut { border-left: 4px solid var(--danger-ink); }
.today-row .t-main { flex: 1 1 260px; min-width: 0; }
.today-row .t-tags { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: center; margin-bottom: var(--space-1); }
.today-row .summary { font-weight: 560; }
.today-row .where { color: var(--muted); font-size: var(--fs-2); overflow-wrap: anywhere; }
.today-row .t-next { flex: none; }
.today-group .more { margin: var(--space-3) 0 0; }
