:root {
  --red: #c12143;
  --red-soft: #faeef0;
  --link: #396291;
  --text: #383d42;
  --text-strong: #353535;
  --muted: #6b7280;
  --kicker: #5b6168;
  --line: #cfd7dd;
  --badge-bg: #f6fafe;
  --badge-stroke: #1775d3;
  --staff-bg: #f6fafe;
  --staff-stroke: #396291;
  --citizen-bg: #faf8f6;
  --elevated: #faf8f6;
  --pill-bg: #f2f4f6;
  --pill-stroke: #c5cbd1;
  --send: #1e4f82;
  --white: #ffffff;
  --page: #ffffff;
  --header-h: 48px;
  --hop-pad-top: 20px;
  --crumb-to-title: 8px;
  --title-pad-bottom: 8px;
  --composer-pad: 12px;
  --thread-pad: 12px;
  --content-pad: 20px;
  --col: 100%;
  --col-left: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --vv-offset: 0px;
  --proto-h: 36px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Open Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--page);
  min-height: 100dvh;
}
a { color: var(--link); }
button { font-family: inherit; }
img.icon { display: block; }

/* Prototype switcher on the landing page only — not sticky */
.proto-bar {
  height: var(--proto-h);
  background: #2b2f33;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  font-size: 13px;
}
.proto-bar a { color: #fff; text-decoration: none; padding: 4px 10px; border-radius: 99px; }
.proto-bar a.is-active { background: #fff; color: #2b2f33; font-weight: 600; }
.proto-bar .proto-label { opacity: 0.7; margin-right: auto; }

/* Floating prototype switcher on the thread pages */
.proto-fab {
  position: fixed;
  z-index: 50;
  right: 12px;
}
body.variant-toppen .proto-fab { bottom: 16px; }
body.variant-botten .proto-fab { top: 12px; }
.proto-fab-btn {
  background: #2b2f33;
  color: #fff;
  border: 0;
  border-radius: 99px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}
.proto-fab-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.proto-menu {
  position: absolute;
  right: 0;
  background: #2b2f33;
  color: #fff;
  border-radius: 10px;
  padding: 8px;
  display: none;
  flex-direction: column;
  min-width: 200px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}
.proto-fab.is-open .proto-menu { display: flex; }
body.variant-botten .proto-menu { top: calc(100% + 6px); }
body.variant-toppen .proto-menu { bottom: calc(100% + 6px); }
.proto-menu a {
  color: #fff;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.proto-menu a.is-active { background: #fff; color: #2b2f33; font-weight: 600; }
.proto-menu a:hover:not(.is-active) { background: rgba(255,255,255,0.12); }

/* 1177 header */
.site-header { background: var(--red-soft); border-bottom: 1px solid var(--line); }
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding-right: 8px;
}
.logo-1177 {
  background: var(--red);
  color: #fff;
  font-family: Inter, "Open Sans", sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
  height: 48px;
  width: 92px;
  display: flex;
  align-items: center;
  padding-left: 14px;
  border-bottom-right-radius: 48px;
  text-decoration: none;
  color: #fff;
}
.header-actions { display: flex; align-items: center; gap: 4px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 99px;
  height: 36px;
  padding: 0 10px 0 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  max-width: 200px;
}
.user-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 40px; height: 40px;
  border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.navbar {
  display: none;
  height: 56px;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 0 88px;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
}
.navbar a {
  display: flex; align-items: center;
  padding: 0 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
  white-space: nowrap;
  border-bottom: 5px solid transparent;
}
.navbar a.is-current { font-weight: 700; border-bottom-color: var(--red); }

/* Breadcrumb + heading */
.crumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px;
  min-height: 24px;
  color: var(--link);
  text-decoration: none;
}
.crumb-desktop { display: none; color: var(--text); }
.crumb-desktop a { color: var(--link); text-decoration: underline; }
.crumb-desktop .current { color: var(--text); text-decoration: none; }

.heading-full, .hop {
  background: #fff;
}
.heading-full { padding: 20px var(--content-pad) 24px; }
.heading-full .crumb { margin-bottom: 0; }
.heading-full .title-block { margin-top: 24px; }
.meta-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 16px;
  font-size: 16px;
  color: var(--text);
}
.alert {
  margin-top: 20px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-stroke);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  font-size: 16px;
  line-height: 1.4;
}
.alert a { color: var(--link); }

.hop {
  display: none;
  padding: var(--hop-pad-top) var(--content-pad) var(--title-pad-bottom);
  border-bottom: 1px solid var(--line);
}
.hop .crumb { margin-bottom: var(--crumb-to-title); }

.title {
  font-family: Inter, "Open Sans", sans-serif;
  font-weight: 700;
  font-size: 24px;
  line-height: 1.25;
  color: var(--red);
}
.hop .title { font-size: 20px; }
.clinic {
  display: inline-block;
  margin-top: 4px;
  font-size: 16px;
  color: var(--link);
  text-decoration: underline;
}
.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid var(--badge-stroke);
  background: var(--badge-bg);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  margin-top: 2px;
}

.sticky-top { display: contents; }

/* Header and heading scroll away with the page. Only the composer sticks. */
.site-header { position: relative; z-index: 10; }
.hop { display: none !important; }

/* Thread */
.thread {
  padding: var(--thread-pad) var(--content-pad);
  padding-bottom: 24px;
}
body.variant-botten .thread {
  padding-bottom: calc(24px + var(--composer-h, 64px) + var(--safe-b));
}
.sender {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-strong);
  margin: 16px 0 8px;
}
.sender .time { margin-left: auto; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.bubble {
  position: relative;
  border-radius: 16px;
  padding: 20px 20px 24px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
}
.bubble.staff {
  background: var(--staff-bg);
  border: 1px solid var(--line);
  padding: 32px 20px;
}
.bubble.staff.is-new {
  border: 2px solid var(--staff-stroke);
  overflow: hidden;
}
.bubble.staff.is-new::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  background: var(--staff-stroke);
}
.bubble.citizen {
  background: var(--citizen-bg);
  border: 1px solid var(--line);
  padding: 20px;
}
.bubble.citizen.case-card { padding: 24px 20px; }
.bubble p + p { margin-top: 12px; }
.bubble .sign { margin-top: 12px; }
.msg {
  max-width: 720px;
  margin-bottom: 16px;
  scroll-margin-bottom: calc(var(--composer-h, 64px) + 24px);
  scroll-margin-top: 16px;
}
body.variant-toppen .msg {
  scroll-margin-top: calc(var(--composer-h, 64px) + 16px);
}
.bubble-wrap { position: relative; padding-bottom: 16px; }
.tail {
  position: absolute;
  display: block;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}
.msg[data-kind="staff"] .tail {
  left: -8px;
  bottom: 0;
  width: 30px;
  height: 25px;
}
.msg[data-kind="citizen"] .tail {
  right: -8px;
  bottom: 2px;
  width: 28px;
  height: 24px;
}
.tag-nytt {
  position: absolute;
  top: 12px; right: 12px;
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 4px;
}
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 8px;
  color: var(--link);
  font-size: 14px;
  font-weight: 600;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--staff-stroke);
  opacity: 0.5;
}
.case-card h3 {
  font-family: "Open Sans", sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 26px;
  margin: 0 0 16px;
  color: var(--text);
}
.case-card .kicker {
  font-size: 14px;
  line-height: 20px;
  color: var(--kicker);
  margin: 0 0 16px;
}
.case-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.25;
  color: var(--text);
}
.case-table caption {
  display: none;
}
.case-table th,
.case-table td {
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.case-table thead th {
  background: var(--red-soft);
  font-family: Inter, "Open Sans", sans-serif;
  font-weight: 700;
  padding: 16px 20px;
}
.case-table tbody th,
.case-table tbody td {
  background: #fff;
  font-weight: 400;
  padding: 12px 20px;
}
.case-table thead th:first-child,
.case-table tbody th {
  width: 37%;
}
.case-table ul {
  margin: 0;
  padding-left: 1.15em;
}
.attach-thumb {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 189px;
  max-width: 100%;
}
.attach-thumb .thumb {
  width: 160px;
  height: 120px;
  background: #e9e7e4;
  border: 1px solid #d1d4d7;
  display: flex;
  align-items: center;
  justify-content: center;
}
.attach-thumb figcaption {
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
}
@media (max-width: 1023px) {
  .case-table caption {
    display: block;
    caption-side: top;
    background: var(--red-soft);
    border: 1px solid var(--line);
    border-bottom: 0;
    font-family: Inter, "Open Sans", sans-serif;
    font-weight: 700;
    text-align: left;
    padding: 16px 20px;
  }
  .case-table thead { display: none; }
  .case-table,
  .case-table tbody {
    display: block;
    width: 100%;
  }
  .case-table tr {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  .case-table th,
  .case-table td {
    display: block;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  .case-table tbody th {
    border-bottom: 0;
    padding-bottom: 0;
  }
  .case-table tbody td {
    border-top: 0;
    padding-top: 4px;
  }
  .case-table tbody tr + tr th {
    border-top: 1px solid var(--line);
  }
  .case-table .row-attach th {
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
  }
  .case-table .row-attach td {
    border-top: 1px solid var(--line);
    padding-top: 12px;
  }
}
.file-chip, .attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  margin-top: 8px;
}

/* Composer */
.composer-bar {
  background: #fff;
  padding: var(--composer-pad) var(--content-pad);
  padding-bottom: calc(var(--composer-pad) + var(--safe-b));
  border-top: 1px solid var(--line);
}
body.variant-botten .composer-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--vv-offset, 0px);
  z-index: 20;
  box-shadow: 0 -2px 6px rgba(53, 53, 53, 0.08);
}
body.variant-toppen .composer-bar {
  border-top: 0;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 6px rgba(53, 53, 53, 0.08);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chips:empty { display: none; }
.attach-chip button {
  border: 0; background: transparent; cursor: pointer;
  display: inline-flex; padding: 2px;
}
.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
body:not(.is-focus) .composer-row { align-items: center; }
.icon-round {
  width: 36px; height: 36px; flex: none;
  border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  border-radius: 50%;
}
.icon-round.send {
  background: var(--send);
}
.icon-round.send:disabled { opacity: 0.55; }
.pill {
  flex: 1;
  min-width: 0;
  background: var(--pill-bg);
  border: 1px solid var(--pill-stroke);
  border-radius: 22px;
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
}
body.is-focus .pill {
  border-width: 1.5px;
  border-color: var(--link);
  align-items: flex-start;
  padding: 8px 14px;
  border-radius: 22px;
}
.pill textarea {
  width: 100%;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  font-family: "Open Sans", sans-serif;
  font-size: 16px;
  line-height: 24px;
  color: var(--text);
  max-height: calc(24px * 5);
  min-height: 24px;
  field-sizing: content;
}
.pill textarea::placeholder {
  font-style: italic;
  color: var(--muted);
  opacity: 1;
}

/* Home / switcher page */
.home { max-width: 640px; margin: 0 auto; padding: 32px 20px 64px; }
.home h1 { font-family: Inter, sans-serif; color: var(--red); font-size: 28px; margin: 16px 0 8px; }
.home p.lead { font-size: 16px; line-height: 1.5; margin-bottom: 24px; }
.cards { display: grid; gap: 16px; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 2px solid var(--staff-stroke);
  background: var(--staff-bg);
  border-radius: 16px;
  padding: 24px;
}
.card-link h2 { font-family: Inter, sans-serif; color: var(--red); font-size: 20px; margin-bottom: 8px; }
.card-link p { font-size: 15px; line-height: 1.45; color: var(--text); }

/* Desktop */
@media (min-width: 1024px) {
  :root {
    --header-h: 176px; /* 120 top + 56 navbar */
    --crumb-to-title: 24px;
    --title-pad-bottom: 16px;
    --composer-pad: 24px;
    --thread-pad: 8px;
    --content-pad: 88px;
    --col: 940px;
  }
  .logo-1177 { width: 212px; height: 120px; font-size: 36px; padding-left: 28px; border-bottom-right-radius: 120px; }
  .header-top { height: 120px; padding-right: 48px; }
  .navbar { display: flex; }
  .crumb-mobile { display: none; }
  .crumb-desktop { display: flex; flex-wrap: wrap; gap: 6px; }
  .title { font-size: 28px; }
  .hop .title { font-size: 24px; }
  .clinic { font-size: 18px; }
  .heading-full, .hop, .thread, .composer-bar {
    /* full-bleed plates; inner column via .col */
  }
  .col, .heading-full .col, .hop .col, .thread, .composer-inner {
    max-width: calc(88px + 940px);
    padding-left: 88px;
    padding-right: 24px;
    margin: 0;
  }
  .heading-full { padding-left: 0; padding-right: 0; }
  .heading-full .col { padding-top: 0; }
  .hop { padding-left: 0; padding-right: 0; }
  .composer-bar { padding-left: 0; padding-right: 0; }
  .pill { min-height: 48px; }
  .bubble.staff, .bubble.citizen { max-width: 720px; }
  .user-chip span.full { display: inline; }
}

@media (max-width: 1023px) {
  .user-chip .full { display: none; }
  .navbar { display: none; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
