:root {
  --system-ui: system-ui, Roboto, Helvetica, Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: #f8f8f8;
  font-family: var(--system-ui);
}

a,
select {
  color: #0075eb;
  &:hover {
    color: #004f9f;
  }
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

p {
  margin: 0.2rem 0 1rem 0;
}

h1 {
  font-size: 2rem;
  font-weight: bold;
  @media screen and (min-width: 880px) {
    font-size: 3rem;
  }
}

h2.columns-header {
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.1rem;
  color: rgba(0, 0, 0, 0.5);
  font-size: 0.8rem;
}

aside h2 {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 0 0 0.4rem 0;
  line-height: 1.1;
}

h5 {
  font-weight: bold;
  margin: 0 0 0.4rem 0;
  font-size: 1.2rem;
}

h6 {
  font-size: 1rem;
  font-weight: bold;
  margin: 0 0 0.4rem 0;
}

.notes {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 20px;
  color: #333;
  @media screen and (min-width: 820px) {
    display: flex;
  }
  gap: 64px;
  position: relative;
  margin-bottom: 24px;

  & .notes-nav {
    flex: 0 0 206px;

    & .nav-jump-links {
      display: block;
      font-size: 0.9rem;
      padding: 6px 0;
      margin-top: 2px;
      line-height: 1.2;
    }

    & .nav-section {
      display: block;
      color: rgba(0, 0, 0, 0.4);
      margin-top: 1.5rem;
      font-size: 0.8rem;
    }
  }

  & .notes-body {
    padding: 24px 0;
  }

  & .notes-section {
    @media screen and (min-width: 1080px) {
      display: flex;
      flex-wrap: wrap;
    }
    gap: 64px;
    border-top: 1px solid rgba(0, 0, 0, 0.2);
    padding-top: 32px;
    margin-bottom: 2rem;
    position: relative;
  }

  & h5:after {
    content: ".";
    background: #333;
    width: 160px;
    height: 2px;
    color: transparent;
    position: absolute;
    top: 0;
    left: 0;
  }

  @media screen and (min-width: 1080px) {
    & .notes-note {
      width: calc(50% - 32px);
      flex-grow: 0;
      flex-shrink: 0;
    }

    & .notes-details {
      width: calc(50% - 32px);
      flex-grow: 0;
      flex-shrink: 0;
    }
  }

  & h2 {
    margin-top: 16px;
  }

  & h3 {
    text-transform: uppercase;
    font-size: 0.92rem;
    font-weight: bold;
    margin: 0;
  }

  & h6 {
    color: teal;
  }

  & p {
    margin-bottom: 1rem;
  }

  & i {
    font-size: 1rem;
    background: white;
    padding: 0 4px;
    font-family: monospace;
    border-radius: 4px;
    color: darkgoldenrod;
    font-style: normal;
    white-space: nowrap;
  }

  & blockquote {
    background: #283336;
    border-top: 2px solid rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.6);

    & code {
      font-size: 0.8rem;
      background: rgba(255, 255, 255, 0.2);
      color: #fff;
    }

    & i {
      font-size: 0.8rem;
      background: rgba(255, 255, 255, 0.2);
      color: aquamarine;
    }

    & h6 {
      font-size: 0.6rem;
      text-transform: uppercase;
      letter-spacing: 0.1rem;
      color: gold;
    }
  }
}

code {
  font-size: 1rem;
  background: white;
  padding: 0 4px;
  border-radius: 4px;
  color: cadetblue;
}

hr {
  margin: 3rem 0;
  border-color: rgba(0, 0, 0, 0.2);
}

main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 1600px;
  margin: auto;
  padding: 0 16px 16px;

  .columns-2,
  .columns-3 {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
  }
}

@media screen and (min-width: 880px) {
  main {
    padding: 0 24px 16px;

    .columns-2,
    .columns-3 {
      flex: 0 0 50%;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
}

@media screen and (min-width: 1200px) {
  main {
    .columns-3 {
      flex: 0 0 50%;
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }
}

.col-span-2 {
  grid-column: span 1;
  @media screen and (min-width: 1200px) {
    grid-column: span 2;
  }
}

.banner {
  background: #0075eb;
  width: 100%;
  font-size: 0.85em;

  .banner-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    @media screen and (min-width: 660px) {
      grid-template-columns: 1fr 180px 1fr;
    }
    justify-content: center;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 1600px;
    margin: auto;
    padding: 16px 22px;
    @media screen and (max-width: 660px) {
      padding: 10px 16px 16px;
    }
    position: relative;
    font-weight: 600;
    font-size: 0.9em;
    color: rgba(0, 0, 0, 0.5);

    h1 {
      display: flex;
      justify-content: start;
      align-items: center;
      @media screen and (min-width: 660px) {
        justify-content: center;
      }

      font-size: 1.2rem;
      .logo {
        width: 22px;
        display: inline-block;
      }
      span {
        color: #fff;
      }
    }
  }

  & .section {
    display: flex;
    gap: 16px;
  }

  .navigation-title-image {
    margin: -2px 8px 0 8px;
    display: inline-block;
  }

  & .link-list {
    display: flex;
    justify-content: end;
    align-items: center;
    gap: 20px;
    order: 0;
  }

  .external-link {
    &::after {
      content: " ↗";
    }
  }

  & a {
    color: #fff;
    display: inline-block;
    padding: 4px 2px;
  }

  & span {
    display: inline-block;
    padding: 4px 2px;
  }
}

.link-dashboards {
  font-size: 0.9rem;
  margin: 0 0 2rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);

  & ul {
    display: flex;
    gap: 4px;
    margin: auto;
    padding: 0 24px;
    @media screen and (max-width: 660px) {
      padding: 0 16px;
    }
    max-width: 1600px;
  }
  & li {
    padding: 6px 0 3px;
    display: block;
  }
  & li.active-link {
    border-bottom: 3px solid cornflowerblue;
  }
  & a {
    color: #555;
    padding: 6px 14px;
    white-space: nowrap;
    display: block;
    border-radius: 6px;
    transition: 50ms all ease-in-out;
  }
  & li.active-link a {
    color: #000;
  }
  & a:hover {
    text-decoration: none;
    background: rgba(0, 0, 0, 0.075);
  }
}

@media screen and (min-width: 880px) {
  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }
}

.date-updated {
  font-size: 0.9em;
}

.spacer {
  margin-top: 2rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 16px 20px 20px;

  background: #ffffff;
  border: 1px solid #cbcbcb;
  border-radius: 8px;

  &&.blank {
    background: rgba(0, 0, 0, 0.05);
    border: none;
  }

  &.normal-flow {
    justify-content: flex-start;
  }

  .chart {
    height: 260px;
    margin: -8px;
  }

  & h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-right: 24px;
  }

  & h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-right: 24px;
  }

  & h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-top: 18px;
  }

  .figures {
    margin: 12px 0 0 0;

    & .large-num {
      font-size: 2rem;
      font-weight: 700;
      margin: 0;
    }

    & .detail p {
      font-size: 0.9rem;
      margin: 0.2rem 0;
    }
  }

  .extra {
    margin-top: 32px;

    & p {
      margin: 8px 0;
      font-size: 0.9rem;
      & span {
        font-weight: 800;
      }
    }

    .agreed {
      color: rgb(3, 155, 64);
    }

    .remind {
      color: rgb(228, 151, 20);
    }
    .removed {
      color: rgb(211, 23, 64);
    }
  }
}

.info {
  display: flex;
  position: absolute;
  top: 16px;
  right: 16px;
  justify-content: center;
  align-items: center;
  background: #999;
  width: 18px;
  height: 18px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  border-radius: 100px;
  cursor: pointer;
  text-align: left;
  &::before {
    content: "?";
  }

  .info-hover-text {
    display: none;
    white-space: normal;
    flex-direction: column;
    gap: 6px;
    position: absolute;
    right: 32px;
    background: #222;
    width: 220px;
    font-size: 0.75rem;
    font-weight: 400;
    padding: 8px 10px;
    border-radius: 6px;
    color: #eee;
    opacity: 0;
    animation: fadeIn 190ms;

    /* triangle */
    &:after {
      content: "";
      position: absolute;
      top: 50%;
      right: -6px;
      transform: translateY(-50%);
      width: 0;
      height: 0;
      border-top: 6px solid transparent;
      border-bottom: 6px solid transparent;
      border-left: 6px solid #222;
    }

    > p {
      margin: 3px 0;
    }

    > p > span {
      font-weight: 800;
      color: #fff;
    }
  }

  &:hover {
    .info-hover-text {
      display: flex;
      opacity: 1;
    }
  }
}

.table-wrap {
  overflow-x: scroll;
  width: calc(100% + 20px);
  padding-right: 20px;
}

.table-scroll-message {
  text-align: right;
  margin: 24px 0 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
}

table {
  width: 100%;
  /* width: calc(100% - 20px); */
  margin: 36px 0 18px 0;
  font-size: 0.9rem;

  & tr {
    border-bottom: 1px solid rgb(224, 224, 224);
  }

  & tbody {
    & .totals {
      background: #fff8d7;
    }
    & tr {
      &:hover:not(.totals) {
        background: #f8f8f8;
      }
      &:last-child {
        border-bottom: none;
      }
    }
  }

  & th,
  & td {
    text-align: left;
    font-weight: 400;
    padding: 6px 12px;
    border-right: 1px solid rgb(224, 224, 224);
    white-space: nowrap;
    &:last-child {
      border-right: none;
    }
  }

  & th {
    font-weight: 700;
  }

  & .head-bg {
    background: #eee;
  }

  & .number {
    text-align: right;
  }

  &.relaxed {
    & th,
    & td {
      padding: 12px 0px;
      font-size: 1rem;
      font-weight: 600;
    }
    & .secondary {
      color: #717171;
      padding-left: 12px;
      border-top: 1px solid #eee;
    }
  }
}

.cohort {
  margin: 24px 0;
  display: flex;
  flex-direction: row wrap;
  gap: 24px;
}

.cohort-quarter {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  width: 120px;
}
.cohort-detail {
  font-size: 0.9rem;

  & b {
    display: block;
    white-space: nowrap;
  }

  & .text-grey {
    margin-top: 1em;
    font-size: 0.85em;
  }
}

.cohort-bar {
  display: flex;
  overflow: hidden;
  gap: 2px;
  color: #fff;
  font-weight: 700;
  flex-direction: column;
  height: 340px;
  border-radius: 4px;
  margin: 0 0 8px 0;
  & .segment {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5em;
    font-size: 0.9em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
}
.key {
  gap: 16px;
  margin-top: 12px;

  @media screen and (min-width: 880px) {
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }

  & div {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  &.key-per-row {
    flex-direction: column;
    align-items: start;
    gap: 4px;
  }
}

.key-color-box {
  display: inline-flex;
  width: 18px;
  height: 18px;
  content: "";
  border-radius: 2px;
  justify-content: center;
  align-items: center;
  position: relative;
  top: -1px;
  text-align: center;
  line-height: 16px;
}

.key-text {
  font-size: 0.92em;

  @media screen and (min-width: 880px) {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.warning {
  color: #ff3355;
  background: rgba(255, 51, 85, 0.1);
  border: 1px solid rgba(255, 51, 85, 0.3);
  border-right: 1px solid rgb(224, 224, 224);
  border-left-width: 0px;
  &::before {
    content: "⚠️ ";
    color: #ff3355;
  }

  &.warning-key {
    border-width: 1px;
  }
}

.expiry {
  background: #ffffe8;
  color: #c89900;
  border: 1px solid rgba(255, 221, 51, 0.75);
  border-right: 1px solid rgb(224, 224, 224);
  border-left-width: 0;
  /* display: flex; */
  gap: 8px;
  justify-content: space-between;
  content: "Risk of expiring meds";
  &.expiry-key {
    color: #d7ba27;
    border-width: 1px;
  }
}

.expiry-text {
  display: flex;
  justify-content: space-between;
  &::before {
    content: "Risk of expiring meds";
  }
}

.facility-list {
  & li {
    padding: 6px 0 0 0;
  }
}

.text-center th {
  text-align: center;
}

.text-right {
  text-align: right;
}

.coverage {
  display: flex;
  margin-top: 32px;
}

.coverage p {
  padding: 2px 8px;
}

.label-small {
  font-size: 0.8rem;
  line-height: 1.2;

  &.dm-label-small {
    @media screen and (max-width: 556px) {
      font-size: 0.66rem;
    }
  }
}

.coverage-column {
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  flex: 1;
}

.coverage-divider {
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  width: 8px;
  flex: 0 0 auto;
  background: repeating-linear-gradient(
    45deg,
    #eee,
    #eee 2px,
    #ffffff 0px,
    #ffffff 4px
  );
}

.coverage-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 260px;
  margin-bottom: 4px;
}

.coverage-bar-fill {
  position: relative;
  background: #dae0e1;
  font-size: 1.2rem;
  font-weight: bold;
  color: #6d7070;
}

.coverage-number {
  position: absolute;
  top: -4px;
  transform: translateY(-100%);
  padding-left: 8px;
  /* padding-bottom: 16px; */
}

.coverage-estimated {
  text-align: center;
  margin-top: 4px;
}

.facilities-without-bp-monitor {
  font-size: 0.9rem;
}

/* Text */

.bold {
  font-weight: 700;
}

.italic {
  font-style: italic;
}

.text-grey {
  color: #888;
}

.bp-controlled {
  color: #3bb231;
}
.bp-controlled-dark {
  color: #096301;
}
.bp-controlled-bg {
  background: #3bb231;
}
.bp-controlled-dark-bg {
  background: #096301;
}

.bp-uncontrolled {
  color: #eeab00;
}

.bp-uncontrolled-bg {
  background: #eeab00;
}
.bp-uncontrolled-dark {
  color: #c08b00;
}

.bp-uncontrolled-dark-bg {
  background: #c08b00;
}

.three-month-ltfu {
  color: #ed6300;
}
.three-month-ltfu-bg {
  background: #ed6300;
}

.twelve-month-ltfu {
  color: #ff3355;
}
.twelve-month-ltfu-bg {
  background: #ff3355;
}

.under-care {
  color: #b51bdc;
}
.under-care-bg {
  background: #b51bdc;
}

.registrations {
  color: #007ee4;
}
.registrations-bg {
  background: #007ee4;
}

.step-one-drugs {
  background: #222;
}
.step-two-drugs {
  background: #d8db56;
}
.step-three-drugs {
  background: #18d6a8;
}

.overdue {
  color: #e77215;
}

.overdue-called {
  color: #edbe00;
}

.overdue-called-denominator {
  color: rgb(214, 159, 6);
}

.overdue-returned {
  color: #5300e0;
}

/* Display options */
.desktop-only {
  @media screen and (max-width: 880px) {
    display: none !important;
  }
}

.mobile-only {
  @media screen and (min-width: 880px) {
    display: none !important;
  }
}

/* Table sort */

th[role="columnheader"] div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

th[role="columnheader"] div:not(.no-sort) {
  cursor: pointer;
  /* white-space: nowrap; */
}

th[role="columnheader"] div:not(.no-sort):after {
  content: "";
  /* float: right; */
  margin-top: 9px;
  border-bottom: none;
  border-width: 4px 4px 0;
  border-color: #404040 transparent;
  opacity: 0.25;
  -ms-user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

th.text-right[role="columnheader"] div {
  flex-direction: row-reverse;
}

th.text-right[role="columnheader"] div:not(.no-sort):after {
  /* float: left; */
}

th[aria-sort="ascending"] div:not(.no-sort):after {
  border-width: 0 4px 4px;
  border-style: solid;
  border-color: #0035bc transparent;
  opacity: 1;
  margin-bottom: 8px;
}

th[aria-sort="descending"] div:not(.no-sort):after {
  border-bottom: none;
  border-width: 4px 4px 0;
  border-color: transparent #0035bc;
  opacity: 1;
}

th[aria-sort]:not(.no-sort) div:after {
  visibility: visible;
  opacity: 0.8;
  border-color: #0035bc transparent;
  margin-top: 9px;
}

th[aria-sort]:not(.no-sort) {
  background: #d9e3ff;
  color: #0035bc;
  outline: 1px solid #4b7eff;
  outline-offset: -1px;
}

th[role="columnheader"] div:not(.no-sort):hover:after {
  visibility: visible;
  opacity: 1;
}

/* Region Select Navigation */

.region-nav {
  position: relative;
  color: #777;
  grid-column: 1 / span 2;
  order: 1;
  @media screen and (min-width: 660px) {
    grid-column: 1;
    order: 0;
    max-width: fit-content;
    display: inline-block;
  }
  .hover-button {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    display: inline;
    border-radius: 4px;
    font-weight: 600;
    display: block;
    text-align: center;
    @media screen and (min-width: 660px) {
      text-align: left;
    }
  }

  .hover-button-hover-state {
    background: none;
    border: none;
    color: #777;
  }

  a {
    color: #0175eb;
  }

  ul {
    list-style-type: none;
    font-size: 14px;
  }
}

.region-nav:hover .nav-hover-content,
.region-nav:focus .nav-hover-content,
.region-nav:active .nav-hover-content {
  display: block;
}

.nav-hover-content {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  width: 100%;
  @media screen and (min-width: 660px) {
    width: 300px;
  }
  display: none;
  padding: 0px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.nav-list {
  padding: 10px 20px 20px 20px;

  a {
    display: block;
    margin-left: 28px;
    padding-left: 8px;
  }
}

.region-nav [aria-current]:not([aria-current="false"]) {
  background: LightGoldenrodYellow;
  border-radius: 100px;
}

.caret {
  cursor: pointer;
  -webkit-user-select: none; /* Safari 3.1+ */
  -moz-user-select: none; /* Firefox 2+ */
  -ms-user-select: none; /* IE 10+ */
  user-select: none;
  font-weight: 900;
  display: inline-block;
  text-align: center;
  position: absolute;
}

.caret::before {
  content: "›";
  background: #e5e9f8;
  border-radius: 100px;
  color: #0075eb;
  height: 24px;
  width: 24px;
  display: inline-block;
  position: relative;
  top: -1px;
}

.caret-down::before {
  rotate: 90deg;
  position: relative;
  background: #cbd1e9;
}

.nested {
  display: none;
  margin-left: 20px;
}

.region-nav .active {
  display: block;
}

.region-nav li {
  padding: 6px 0 0 0;
}

.region-nav .region-national a {
  margin-left: 0;
  padding-left: 0;
}

.region-nav .region-facility {
  font-size: 0.9em;
  padding: 2px 0;
  font-weight: normal;
}

.search-form {
  padding: 14px 20px 4px 20px;
}

.region-search {
  background: #e5e9f8
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>')
    10px 50% no-repeat;
  background-size: 16px;
  border-radius: 100px;
  padding: 6px 16px 6px 30px;
  display: block;
  width: 100%;
  /* margin: 8px 0 0 20px; */
  label {
    font-size: 0.9em;
  }
}

.hidden {
  display: none;
}

.search-results {
  padding: 0 0 20px;

  dt {
    text-transform: uppercase;
    letter-spacing: 0.075em;
    padding: 0.4em 20px 0.4em;
    margin-top: 0.8em;
    margin-bottom: 0.75em;
    color: #747474;
    background: #f4f4f4;
    border-top: 1px solid #e0e0e0;
  }

  dd {
    padding-left: 20px;
    padding-right: 20px;
    a {
      display: block;
      padding: 3px;
      font-size: 14px;
    }
    em {
      font-style: normal;
      background: #fbf168;
    }
    span {
      font-weight: normal;
      padding: 0;
    }
    .no-result {
      padding: 2em 0 0;
      text-align: center;
    }
  }
}
