@import "_colors.css";
@import "_planning.css";

@import url("https://fonts.googleapis.com/css?family=Asap:400,600");
/* Asap is still used in print styles for now */
@import url("https://fonts.googleapis.com/css2?family=Schibsted+Grotesk:wght@400;500;600;700");

/* Animations */

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes stay {
  from,
  to {
    opacity: 1;
    right: 1em;
  }
}

@keyframes slide-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Body */

body {
  background: white;
  color: var(--text);
  display: grid;
  grid-template-rows: 1fr minmax(0, min-content);
  grid-template-columns: 15em 5fr;
  grid-template-areas: "nav main" "nav footer";
  font-family: "Schibsted Grotesk", sans-serif;
  font-weight: 400;
  height: 100vh;
  margin: 0;

  &:has(header.sidebar-collapsed) {
    grid-template-columns: 4em 5fr;

    #side-planning,
    #side-reminder {
      &::before,
      &::after {
        display: none;
      }
    }

    /* Target main navigation */
    #sidebar {
      ul {
        &::before {
          background: url(/static/images/paperclip.svg) no-repeat center;
          background-size: 30%;
          content: "";
          margin-left: 0;
          width: 2.5rem;

          .october & {
            background-image: url(/static/images/paperclip-octobre-rose.svg);
            background-size: 1rem;
          }
        }

        li {
          a {
            border-radius: 0.25rem;
            font-size: 0;
            height: 2.5rem;
            position: relative;
            padding: 0 0.75rem;

            &.sidebar-icon {
              svg {
                position: initial;
              }
            }

            &.tooltip-sidebar {
              position: relative;

              &:hover {
                &::after {
                  background: var(--action);
                  border-radius: 0.25rem;
                  color: white;
                  content: attr(data-tooltip);
                  font-family: "Schibsted Grotesk", sans-serif;
                  font-size: 0.9rem;
                  font-weight: 500;
                  left: 3rem;
                  min-width: max-content;
                  padding: 0.5rem;
                  position: absolute;
                  text-align: center;
                  z-index: 10;
                }
              }
            }

            &.sidebar-icon {
              &.icon-unfold::before {
                transform: scale(-1, -1);
              }
            }
          }
        }
      }

      #user a,
      #logout a {
        height: 2.5rem;

        &::before {
          margin-right: 0;
        }
      }

      #user a {
        border-radius: 0.25rem;
      }

      #logout a {
        margin-top: 0.5rem;
      }
    }
  }

  &.privacy {
    .pii {
      filter: blur(5px);
      transition: filter 0.3s ease;
    }

    ~ .select2-container .select2-selection__rendered {
      filter: blur(5px);
      transition: filter .3s ease;
    }
  }

  &.development {
    border: 3px solid var(--action);
    box-sizing: border-box;

    &::after {
      background: var(--action);
      border-bottom-right-radius: 1rem;
      border-bottom-left-radius: 1rem;
      color: white;
      content: "Site de test";
      font-size: 0.9em;
      font-weight: 600;
      padding: 1rem;
      position: absolute;
      right: 0;
      text-transform: uppercase;
      transform: translateX(100%) rotate(90deg);
      transform-origin: 0 0;
      top: 50%;
      user-select: none;
      z-index: 99;
    }
  }

  h1, h2, h3, h4 {
    font-weight: 500;
    letter-spacing: -0.025em;
  }

  h1 {
    font-size: 1.75em;
    font-weight: 600;
    margin-top: 0;
  }

  h2 {
    font-size: 1.4em;
  }

  h3 {
    font-size: 1.25em;
  }

  .icon-appointment::before {
    content: url(/static/images/icons/icon-appointment.svg);
  }

  .icon-clients::before {
    content: url(/static/images/icons/icon-clients.svg);
  }

  .icon-dashboard::before {
    content: url(/static/images/icons/icon-dashboard.svg);
  }

  .icon-estimate::before {
    content: url(/static/images/icons/icon-estimate.svg);
  }

  .icon-hide::before {
    content: url(/static/images/icons/icon-hide.svg);
  }

  .icon-invoicing::before {
    content: url(/static/images/icons/icon-invoicing.svg);
  }

  .icon-logout::before {
    content: url(/static/images/icons/icon-logout.svg);
  }

  .icon-notebook::before {
    content: url(/static/images/icons/icon-notebook.svg);
  }

  .icon-profile::before {
    content: url(/static/images/icons/icon-profile.svg);
  }

  .icon-reminders::before {
    content: url(/static/images/icons/icon-reminders.svg);
  }

  .icon-schedule::before {
    content: url(/static/images/icons/icon-schedule.svg);
  }

  .icon-services::before {
    content: url(/static/images/icons/icon-services.svg);
  }

  .icon-show::before {
    content: url(/static/images/icons/icon-show.svg);
  }

  .icon-sessions::before {
    content: url(/static/images/icons/icon-sessions.svg);
  }

  .icon-statistics::before {
    content: url(/static/images/icons/icon-statistics.svg);
  }

  .icon-unfold::before {
    content: url(/static/images/icons/icon-unfold.svg);
  }

  .icon-users::before {
    content: url(/static/images/icons/icon-users.svg);
  }
}

/* Footer */

body > footer {
  align-items: center;
  background: var(--light);
  grid-area: footer;
  font-size: 0.9em;
  padding: 0 2em;

  dl {
    align-items: center;
    display: flex;
    margin: 0;
    padding: 1em 0;

    dt {
      font-weight: 500;
    }

    dt,
    dd {
      margin: 0;
    }

    dt::after {
      content: " : ";
    }

    dd {
      padding-right: 1em;
      flex-wrap: wrap;
    }

    .cal-button {
      align-content: center;
      background: var(--action);
      border-radius: 0.25em;
      border: none;
      color: white;
      font-family: "Schibsted Grotesk", sans-serif;
      font-size: 1em;
      font-weight: 500;
      margin-left: auto;
      padding: 1em;
      transition: 0.5s background;

      &:hover {
        background: var(--action-hover);
        cursor: pointer;
      }
    }
  }

  &.appointment-icon {
    align-items: center;
    display: flex;
    gap: 1em;

    dl {
      width: 100%;
    }

    dt::after {
      display: none;
    }

    &::before {
      background: url(/static/images/icons/icon-appointment.svg) no-repeat
        center;
      background-size: contain;
      border-radius: 0.25em;
      content: "";
      height: 2.5rem;
      width: 2.5rem;
    }
  }
}

/* Menus */

body > header,
.subnav {
  font-size: 1em;
  position: relative;

  ul {
    box-sizing: border-box;
    display: flex;
    margin: 0;
    padding: 0;

    li {
      align-items: center;
      display: flex;

      a {
        display: block;
        letter-spacing: 0.015em;
        outline: 0;
        text-decoration: inherit;
        transition: 0.5s color, 0.5s background;
        width: 100%;
      }

      &.active a {
        font-weight: 500;
      }
    }
  }
}

body > header {
  background: var(--text);
  grid-area: nav;
  padding: 0.5em 0.75em;

  ul {
    display: flex;
    flex-direction: column;
    gap: 0.5em 0;
    height: 100%;
    margin: 0;
    padding: 0;

    &::before {
      content: "";
      background: url(/static/images/logo-backoffice-sidebar.svg) no-repeat
        center;
      background-size: contain;
      display: block;
      height: 3em;
      margin-bottom: 0.75em;
      margin-left: 0.75em;
      width: 7em;

      .october & {
        background-image: url(/static/images/logo-backoffice-sidebar-octobre-rose.svg);
      }
    }

    li {
      &:has(.sidebar-toggle) {
        /* Weasyprint tinycss2 does not support color-mix yet:
           https://github.com/Kozea/tinycss2/issues/65 */
        /* border-bottom: 1px solid color-mix(in srgb, var(--light), black 55%); */
        border-bottom: 1px solid #68607a;

        &:hover {
          cursor: pointer;
        }
      }

      a {
        align-items: center;
        border-radius: 0.25em;
        color: var(--light);
        display: flex;
        height: 2.5em;
        padding: 0 0.75em;

        &:hover {
          background: rgba(var(--light), 0.2);
        }

        &.sidebar-icon {
          display: flex;
          &::before {
            filter: url(#svgFilterLight);
            height: 16px;
            margin-right: 0.75em;
            width: 16px;
          }
        }
      }

      &.active a {
        background: var(--active);
        color: var(--text);

        &.sidebar-icon {
          &::before {
            filter: url(#svgFilterDarkblue);
          }
        }
      }
    }
  }

  #user {
    margin-top: auto;

    a {
      background: var(--light);
      border-radius: 0.25em;
      color: var(--text);
      height: fit-content;
      justify-content: center;
      padding: 0.75em;
      transition: border-color 0.3s, background 0.3s;

      &::before {
        filter: url(#svgFilterDarkblue);
        font-size: 1rem;
        margin-right: 0.75em;
      }

      &:hover {
        background: var(--action);
        color: var(--light);

        &::before {
          filter: url(#svgFilterLight);
        }
      }
    }
  }

  #logout {
    a {
      border: 1px solid var(--light);
      margin-top: 0.25em;
      height: fit-content;
      justify-content: center;
      transition: border-color 0.3s, background 0.3s;
      padding: 0.75em;

      &:hover {
        background: var(--alert);
        border-color: var(--alert);
        color: white;
      }

      &::before {
        font-size: 1rem;
        margin-right: 0.75em;
      }
    }
  }
}

.subnav {
  border-bottom: 1px solid var(--border);
  display: flex;
  margin-bottom: 1em;

  ul {
    width: 100%;

    li {
      border-bottom: 1px solid transparent;
      margin: 0 0.5em -1px 0.5em;

      &:hover {
        border-bottom-color: var(--action);
      }

      &:first-of-type {
        margin-left: 0;

        a {
          padding-left: 0;
        }
      }

      &.active {
        border-bottom: 2px solid var(--action);
        margin-bottom: -2px;

        a {
          border-radius: 0;
          color: var(--action);

          &:hover {
            background: none;
            color: var(--action);
          }
        }
      }

      a {
        color: var(--text-hue-light);
        padding: 0.75em 0;

        &:hover {
          color: var(--text);
        }
      }
    }
  }
}

body > main {
  grid-area: main;
}

#page-stats,
#page-stats-date {
  .statistics-cover {
    h1 {
      display: none;
    }

    > h2 {
      display: none;
    }
  }

  .details {
    h2 {
      font-size: 2.05em;
      margin-top: 0;
    }
  }
}

#page-global-stats,
#page-global-stats-date {
  header.statistics-cover {
    > h2 {
      display: none;
    }
  }
}

/* Notifications */

#messages {
  .notification-container {
    background: var(--text);
    border-radius: 0.5em;
    bottom: 1em;
    box-shadow: 0.5em 0.5em 2em -0.5em rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    font-size: 1em;
    margin: 0;
    max-width: 20em;
    padding: 1em 1.25em 1em 1em;
    position: fixed;
    right: 1em;
    z-index: 10;

    &:nth-child(n) {
      animation:
        slide-in 0.5s ease-in-out forwards,
        stay 5s 0.5s forwards,
        slide-out 0.5s ease-in-out 5.5s forwards;
    }

    &:nth-child(2) {
      bottom: calc(1em + 4em);
    }

    &.warning,
    &.error,
    &.info,
    &.denied {
      .notification-title::before {
        display: inline-block;
        margin-right: 0.5em;
        vertical-align: middle;
      }
    }

    &.warning {
      .notification-title::before {
        content: url(/static/images/icons/icon-warning.svg);
      }
    }

    &.error,
    &.denied {
      .notification-title::before {
        content: url(/static/images/icons/icon-error.svg);
      }
    }

    &.info {
      .notification-title::before {
        content: url(/static/images/icons/icon-success.svg);
      }
    }

    .notification-title {
      color: var(--light);
      margin: 0;
      font-weight: 600;
      letter-spacing: normal;
    }

    .notification-text {
      color: var(--light);
      line-height: 1.4;
      margin: 0.25em 0 0 0;
      padding-left: calc(24px + 0.5em);

      a {
        color: var(--light);
      }
    }

    li {
      color: var(--light);
      margin-bottom: 0.5rem;

      &:last-of-type {
        margin-bottom: 0;
      }

      a {
        color: var(--light);
      }
    }
  }
}

/* Side panels */

[id^="side-"] {
  background: white;
  bottom: 0;
  box-sizing: border-box;
  box-shadow: 0 0 1em rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  left: 0;
  padding: 0;
  position: fixed;
  top: 0;
  transition: 0.3s left, 0.3s right;
  width: 25%;
  z-index: 5;

  > * {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  &.hidden {
    left: -25%;
  }

  &::before {
    align-items: center;
    background: url(/static/images/icons/icon-close.svg) no-repeat center
      var(--active);

    background-size: 30%;
    border-radius: 100%;
    color: white;
    content: "";
    cursor: pointer;
    display: flex;
    height: 0.75rem;
    justify-content: center;
    left: calc(100% + 1.5em);
    padding: 1rem;
    position: absolute;
    top: 1em;
    width: 0.75rem;
  }

  &.hidden::before {
    background: transparent;
    display: flex;
    left: calc(100% + 150px);
  }

  .side-container {
    overflow: auto;
  }

  section {
    border-top: 1px solid var(--border);
    display: block;
    position: relative;

    &:last-of-type {
      border-bottom: 1px solid var(--border);
    }

    h3 {
      font-size: 1.25em;
    }

    h4 {
      margin: 0.5em 0 0;
    }

    a {
      color: var(--action);
      text-decoration: inherit;
    }

    p {
      font-size: 1em;
      margin: 0.25em 0;

      &:last-child {
        margin-bottom: 1.5em;
      }
    }

    dl {
      font-size: 1em;

      dt, dd {
        display: inline;
        margin: 0;
      }

      dt::after {
        content: " : ";
      }

      dd::after {
        content: "\A";
        white-space: pre-line;
      }
    }

    form {
      align-items: center;
      bottom: 0;
      display: flex;
      position: absolute;
      right: 1em;
      top: 0;
    }
  }

  aside {
    margin-top: auto;
    padding: 2em;

    ul {
      justify-content: center;
    }
  }
}

#side-planning {
  &.hidden::before {
    content: url(/static/images/icons/icon-schedule.svg);
    filter: url(#svgFilterLight);
  }
}

#side-reminder {
  left: 0;
  right: auto;

  &.hidden {
    left: -25%;
    right: auto;
  }

  &::before {
    left: calc(100% + 1.6em);
    right: auto;
  }

  &.hidden::before {
    content: url(/static/images/icons/icon-reminders.svg);
    filter: url(#svgFilterLight);
    left: calc(100% + 180px);
  }

  /* Reminder count badge */

  &::after {
    align-items: center;
    background: var(--action);
    border-radius: 100%;
    color: white;
    content: attr(data-reminders);
    cursor: pointer;
    display: flex;
    font-size: 0.8em;
    font-weight: bold;
    height: 1.5em;
    justify-content: center;
    left: calc(100% + 180px + 2em);
    position: absolute;
    right: auto;
    top: 1em;
    visibility: hidden;
    width: 1.5em;
  }

  &.pending.hidden {
    &::after {
      visibility: visible;
    }
  }
}

/* Main */

body > main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: max-content max-content repeat(10, min-content);
  overflow-y: auto;
  padding: 2em;
  scrollbar-gutter: stable;

  &:before {
    content: "";
  }

  a {
    color: var(--action);
    text-decoration: none;
    transition: color 0.3s;

    &:hover {
      color: var(--action-hover);
    }

    &.ongoing {
      color: var(--active);
    }
  }

  &:has(.error-page) {
    align-content: center;
  }

  .error-page {
    align-items: center;
    display: flex;
    flex-direction: column;

    h1 {
      margin-bottom: 0.5em;
    }

    p {
      font-size: 1.5em;
      margin: 0 0 1em 0;
    }

    a {
      background: var(--action);
      border-radius: 0.25em;
      color: white;
      font-size: 1.2em;
      padding: 1em;
      transition: background 0.3s;

      &:hover {
        background: var(--action-hover);
        cursor: pointer;
      }
    }
  }
}

main > header {
  p {
    font-weight: bold;
    margin-bottom: -1em;
  }

  form {
    align-items: flex-end;
    justify-content: flex-start;
    padding: 1em 0;

    a {
      background: white;
      border: 1px solid #cacde0;
      border-radius: 2em;
      color: var(--text);
      margin-right: 0.5em;
      padding: 0.75em 1em;
      transition: border-color 0.3s, color 0.3s;

      &:last-of-type {
        margin-right: 2em;
      }

      &:hover,
      &.active {
        border-color: var(--action-hover);
        color: var(--action-hover);
      }
    }

    label {
      flex-direction: row;
      padding: 0 1em 0 0;
      position: relative;
      width: auto;

      .select2 {
        background: white;
        padding: 1em;
        width: 100%;

        .select2-selection__rendered {
          padding: 0.5em 0.75em;
          margin: -1em;
        }

        .select2-selection__arrow {
          height: 100% !important;
          top: 0 !important;
        }
      }

      input {
        margin-left: 0;
        width: 100%;
      }
    }

    input, select {
      background: white;
      width: auto;

      &[type="submit"] {
        margin-right: 0;
        margin-top: 0;
      }
    }
  }
}

main > header,
main > h1 {
  grid-row-start: 2;

  .main-information {
    display: flex;

    dd {
      margin-left: 0;
      margin-right: 1em;
    }

    dt {
      font-weight: bold;
      margin-right: 0.25em;

      &.uppercase {
        text-transform: uppercase;
      }

      &::after {
        content: ":";
        margin-left: 0.25em;
      }
    }
  }
}

main header {
  display: flex;
  flex-wrap: wrap;

  .subnav,
  nav {
    flex: 1 100%;
  }

  &.client-information,
  &.statistics-information {
    align-content: center;
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 1em;

    .subnav {
      font-size: 14px;
      margin: 1em 0;
      width: 100%;

      & + h2 {
        flex: 1 100%;
        margin-top: 1em;
      }

      a {
        color: var(--text);
      }

      .active a {
        color: var(--action);
      }
    }

    .statistics-web {
      align-items: center;
      display: flex;
      flex-wrap: wrap;
      width: 100%;

      nav:has(form) {
        flex: 1 100%;
      }
    }

    .statistics-print {
      display: none;
    }

    #back {
      flex: 1 100%;
      margin-bottom: 0.5em;
      margin-top: 0;

      a {
        font-size: 12px;
        font-weight: 500;
        padding: 0;

        &::before {
          width: 0.5rem;
        }
      }
    }

    h1 {
      display: block;
      font-size: 1.75em;
      font-weight: 600;
      margin: 0;
    }

    h2 {
      font-size: 1.4em;
      font-weight: 400;
      margin: 0;

      &::before {
        background: var(--border);
        content: "";
        display: inline-block;
        height: 20px;
        margin: 0 0.5em;
        vertical-align: middle;
        width: 2px;
      }
    }

    dl {
      align-items: center;
      display: flex;
      color: var(--text-hue-light);
      flex: 1 100%;
      font-size: 14px;
      margin: 0.5em 0 0 0;

      dt {
        font-weight: 600;

        &.client-header-finess {
          border-bottom-left-radius: 0.75em;
          border-top-left-radius: 0.75em;
          padding: 0.25em 0 0.25em 0.5em;
        }

        &::after {
          content: ":";
          margin-left: 0.25em;
        }
      }

      dd {
        margin-left: 0.25em;
        margin-right: 1em;

        &.client-header-finess {
          border-bottom-right-radius: 0.75em;
          border-top-right-radius: 0.75em;
          margin-left: -0.5em;
          padding: 0.25em 0.5em 0.25em 0.25em;

          &::before {
            content: ":";
          }
        }
      }

      .client-header-finess {
        background: var(--light);
      }
    }
  }

  .actions {
    gap: 0 0.75em;
    list-style: none;
    margin: 0 0 0 auto;

    li a {
      background: var(--action);
      color: white;
      font-size: 0.88em;
      /* Was overriden by ul.actions li a */
      /* padding: 0.5em 1em; */
    }
  }
}

/* Vertically smaller buttons but not yet everywhere */
#page-customer-planning,
#page-contracts,
#page-stats,
#page-softwares,
#page-banks
#page-employees,
#page-comments,
#page-global-stats,
#page-invoices {
  .actions li a {
    padding: 0.5em 1em;
  }
}



#actions {
  grid-column-start: 2;
  grid-row-start: 2;
  ul {
    margin: 0;
    gap: 0 0.75em;
  }
}

ul.actions,
#actions > ul {
  display: flex;
  flex-direction: row-reverse;
  font-weight: 500;
  padding: 0;

  li {
    display: block;

    a {
      align-items: center;
      background: var(--action);
      border: 1px solid transparent;
      border-radius: 0.25em;
      box-shadow: -1px 10px 6px -7px rgba(0, 0, 0, 0.07);
      color: white;
      display: flex;
      padding: 1em;
      text-decoration: inherit;
      transition: 0.5s background, 0.5s color;

      &:hover,
      &:focus {
        background: var(--action-hover);
      }

      &::before {
        display: inline-block;
        height: 1rem;
        margin-right: 0.5em;
        transition: background 0.3s, color 0.3s;
        width: 1rem;
      }
    }

    /* Primary buttons */
    &.add a {
      &::before {
        content: url(/static/images/icons/icon-add.svg);
        filter: url(#svgFilterLight);
      }
    }

    &.mail a {
      &::before {
        content: url(/static/images/icons/icon-mail.svg);
        display: inline-block;
        width: 1rem;
      }
    }

    &.launch a {
      &::before {
        content: url(/static/images/icons/icon-launch.svg);
      }
    }

    &#download_invoices {
      a {
        background: var(--action);
        border-color: transparent;
        box-shadow: none;
        color: white;

        &::before {
          filter: url(#svgFilterLight);
        }
      }

      &.disabled {
        a {
          background: var(--light);
          border-color: var(--border);
          color: var(--text-hue-light);
          cursor: not-allowed;

          &::before {
            filter: url(#svgFilterDarkblue);
          }
        }
      }
    }

    /* Secondary buttons */
    &.download,
    &.edit {
      a {
        background: white;
        border-color: var(--border);
        color: var(--text);
        font-weight: 500;

        &:hover {
          background: var(--light);
        }

        &::before {
          filter: url(#svgFilterDarkblue);
        }
      }
    }

    &.download a {
      &::before {
        content: url(/static/images/icons/icon-download.svg);
      }
    }

    &.edit a {
      &::before {
        content: url(/static/images/icons/icon-edit.svg);
      }
    }

    /* Stop planifications on client's planning */
    &.delete {
      a {
        background: var(--stop);
        color: white;

        &:hover {
          /* Weasyprint tinycss2 does not support color-mix yet:
             https://github.com/Kozea/tinycss2/issues/65 */
          /* background: color-mix(in srgb, var(--stop), black 8%); */
          background: #b1252a;
        }

        &::before {
          content: url(/static/images/icons/icon-stop.svg);
        }
      }
    }

    /* Close active session */
    &.close {
      a {
        background: var(--close-session);
        color: var(--close-session-text);
        transition: background 0.5s;

        &:hover {
          /* Weasyprint tinycss2 does not support color-mix yet:
             https://github.com/Kozea/tinycss2/issues/65 */
          /* background-color: color-mix(in srgb, var(--close-session), black 5%); */
          background-color: #266d6d;
        }

        &::before {
          content: url(/static/images/icons/icon-done.svg);
        }
      }
    }
  }
}

aside .actions {
  flex-direction: row;
}

#back {
  grid-row-start: 1;
  margin-bottom: 1em;
  margin-top: -1em;

  a {
    color: var(--action);
    display: inline-block;
    font-size: 0.9em;
    padding: 0.5em 0;
    text-decoration: inherit;
    transition: 0.5s color, transform 0.5s;

    &:hover {
      color: var(--action-hover);
      transform: translateX(-10px);
    }

    &::before {
      content: url(/static/images/icons/icon-back.svg);
      display: inline-block;
      margin-right: 0.5em;
      width: 0.75rem;
    }
  }
}
main > * {
  grid-column: 1 / 3;
}

section {
  align-items: flex-start;
  display: flex;

  aside, article {
    border: 1px solid var(--border);
    display: block;
    padding: 1.5em;

    h2:first-child,
    h3:first-child {
      margin-top: 0;
    }
  }

  aside {
    margin-right: 1em;
    width: 18em;

    a {
      text-decoration: inherit;
    }

    h2, h3, h4, dt {
      color: var(--text);
    }

    h2, h3 {
      font-size: 1.5em;
    }

    dt {
      font-weight: 600;
      margin-top: 0.5em;
      padding: 0.25em 0;
    }

    dd {
      margin: 0;
    }

    article {
      color: var(--text-hue-light);
      margin-left: calc(-1.5em - 1px);
      margin-right: calc(-1.5em - 1px);
      margin-bottom: -1px;
      padding-bottom: 1.5em;

      &:first-child {
        border-top: 0;
        margin-top: -1.5em;
      }

      &:last-child {
        border-bottom: 0;
        margin-bottom: -1.5em;

        ul {
          list-style: none;
          padding-left: 0;

          li {
            border-bottom: 1px solid var(--border);
            margin-bottom: 0.75em;
            padding-bottom: 0.75em;

            &:last-of-type {
              border: none;
            }
          }
        }
      }

      form {
        input[type="file"] {
          background: var(--light);
          border: 1px solid var(--border);
          border-radius: 0.25em;
          color: var(--text);
          font-family: inherit;
          padding: 0.5em;
        }
      }
    }

    h4 {
      margin: 1em 0 0;
    }

    p {
      margin: 0.5em 0;
    }

    table {
      td:nth-child(2) {
        font-size: 0.8em;
      }

      input[type="submit"] {
        background: url(/static/images/icons/icon-delete.svg) no-repeat center;
        display: block;
        font-size: 0;
        height: 1rem;
        width: 1rem;

        &:hover {
          background: url(/static/images/icons/icon-delete.svg) no-repeat center;
        }
      }
    }

    label {
      color: var(--text);
      cursor: pointer;
      padding: 0.7em 1em;
    }

    input {
      margin-top: 1em;
      max-width: 100%;
    }
  }

  article {
    flex: 1;
    margin-bottom: 1em;
  }

  section {
    display: block;
    flex: 1;
  }

  aside#filters {
    border: 0;
    margin-right: 1.5em;
    padding: 0;
    width: fit-content;

    article {
      border: 1px solid var(--border);
      border-radius: 3px;
      display: flex;
      flex-direction: column;
      gap: 0.25em;
      margin: 0 0 0.75em 0;
      padding: 1em;

      h2 {
        font-size: 1.25em;
        font-weight: 500;
        margin-bottom: 0.5em;
      }

      label {
        border-radius: 3px;
        font-size: 1em;
        padding: 0.25em 0.5em;

        &:has(input:checked) {
          background: var(--light);
          color: var(--action);
        }

        &:hover {
          background: var(--light);
        }
      }

      input[type="radio"] {
        accent-color: var(--action);
        appearance: radio;
        background: white;
        height: 15px;
        position: initial;
        width: 15px;
      }
    }
  }
}

.buttons {
  display: flex;
  list-style: none;
  padding: 0;

  li {
    background-color: var(--light);
    border: 1px solid var(--border);
    font-weight: 500;

    &.active {
      background-color: var(--active);
      border-color: var(--active);
    }

    a {
      color: inherit;
      display: block;
      padding: 0.5em 1em;
      text-decoration: inherit;

      &:hover {
        color: var(--text);
      }
    }
  }
}

/* Modals */

#modal {
  align-items: center;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  height: 100vh;
  justify-content: center;
  left: 0;
  position: absolute;
  top: 0;
  width: 100vw;
  z-index: 10;

  aside {
    align-items: center;
    background: var(--light);
    display: flex;
    flex: 1;
    padding: 0.5em;

    select {
      background: white;
      border: 1px solid var(--border);
      border-radius: 0.25em;
      cursor: pointer;
      font-family: "Schibsted Grotesk", sans-serif;
      margin-right: auto;
      order: -1;
      padding: 0.5em;
    }

    button {
      background: var(--light);
      border: 0;
      border-radius: 0.25rem;
      cursor: pointer;
      font-size: 0;
      padding: 0.5rem 0.7rem;
      transition: 0.5s color, 0.5 background;
      margin: 0 0.5em;

      &:hover {
        /* Weasyprint tinycss2 does not support color-mix yet:
           https://github.com/Kozea/tinycss2/issues/65 */
        /* background: color-mix(in srgb, var(--light), black 5%); */
        background: #e5e3e9;
      }

      &::before {
        display: block;
        width: 1rem;
      }

      &#preview::before {
        content: url(/static/images/icons/icon-pdf-preview.svg);
      }

      &#save::before {
        content: url(/static/images/icons/icon-save.svg);
      }

      &#delete::before {
        content: url(/static/images/icons/icon-delete.svg);
        filter: url(#svgFilterDarkblue);
      }

      &#close::before {
        content: url(/static/images/icons/icon-close.svg);
        width: 0.75rem;
      }

      &.tooltip-link {
        position: relative;

        &:hover {
          &::after {
            background: var(--text);
            border-radius: 0.25rem;
            bottom: -2rem;
            box-shadow: 0px 10px 33px #3333332e;
            color: var(--light);
            content: attr(data-tooltip);
            font-family: "Schibsted Grotesk", sans-serif;
            font-size: 0.75rem;
            font-weight: 500;
            left: 0;
            min-width: fit-content;
            padding: 0.5rem;
            position: absolute;
            right: 0;
          }
        }
      }
    }
  }

  article {
    display: block;

    iframe {
      background: white;
      border: 0;
      height: 60em;
      max-height: 90vh;
      max-width: 90vw;
      width: 42em;
    }
  }
}

/* Forms */

form, form article {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;

  h2 {
    width: 100%;
  }

  ul {
    display: flex;

    li {
      display: flex;
    }
  }

  label {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    width: 48%;

    input,
    select,
    textarea,
    .select2 {
      margin-top: 0.25em;
      width: 100%;

      &::placeholder {
        color: var(--text-hue-light-2);
        opacity: 1;
      }
    }
  }

  .floating-submit-button {
    background: white;
    border-top: 1px solid var(--border);
    bottom: -2em;
    margin-bottom: -2em;
    padding: 1em 0;
    position: sticky;
    width: 100%;

    input {
      margin-right: inherit;
      margin-top: 0;
    }
  }
}

form article {
  box-sizing: border-box;
  flex: 1 0 100%;
}

label {
  font-weight: 500;
  font-size: 0.9em;
  line-height: 1.8;
  padding: 0.5em 0 0.2em 0;
  position: relative;

  &.click-zone {
    align-items: center;
    bottom: 0;
    cursor: pointer;
    display: flex;
    font-size: 1em;
    height: 100%;
    justify-content: center;
    left: 0;
    padding: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: background 0.3s;
    width: 100%;

    &:hover {
      /* Weasyprint tinycss2 does not support color-mix yet:
         https://github.com/Kozea/tinycss2/issues/65 */
      /* background: color-mix(in srgb, var(--light), black 5%); */
      background: #e5e3e9;
    }

    input {
      cursor: pointer;
      font-size: 1em;
    }
  }

  &.fullwidth {
    width: 100%;
  }

  input,
  select,
  textarea,
  .select2 {
    border: 1px solid var(--border);
    border-radius: 0.25em;
    box-sizing: border-box;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    order: 10;
    outline: 1px solid transparent;
    padding: 0.75em 1em;
    transition: border-color 0.5s;

    &[readonly],
    &[readonly] + .select2 {
      border: none;
      font-weight: 500;
      padding: 0.25em 0;

      &[type="number"] {
        -webkit-appearance: textfield;
        appearance: textfiel;
      }
    }

    &:focus {
      border-color: var(--action);
    }
  }

  textarea {
    resize: vertical;
  }

  select,
  .select2,
  textarea,
  input[type="file"] {
    color: var(--text);
  }

  &.error {
    input,
    select,
    textarea,
    .select2 {
      outline-color: red;
    }
  }

  .select2-container {
    padding: 0.25em 0.25em 0.25em;

    .select2-search--inline .select2-search__field {
      margin-top: 0;
    }
  }

  .select2-container--default .select2-selection {
    background: transparent;
    border: 0;
  }

  .select2-container--default
    .select2-selection--single
    .select2-selection__arrow {
    opacity: 0.8;
    top: 4px;
  }

  .select2-container {
    &--default {
      &.select2-container--focus {
        .select2-selection--multiple {
          border: 0;
        }
      }

      .select2-search--inline {
        padding-left: 0;
      }

      .select2-selection--multiple {
        .select2-selection__rendered {
          cursor: pointer;
          display: flex;
          flex-wrap: wrap;
          gap: 0.5em;
          padding: 0.5em;
        }

        .select2-selection__choice {
          background-color: white;
          border: 1px solid var(--border);
          box-shadow: -1px 10px 6px -7px rgba(0, 0, 0, 0.07);
          margin: 0;
          padding: 0.25em 0.5em;

          &__remove {
            color: var(--stop);

            &:hover {
              color: var(--stop);
            }
          }
        }
      }
    }
  }

  span.info,
  a.info {
    font-size: 0.8em;
    margin-left: 0.5em;

    &:not(:empty)::before {
      content: "(";
    }

    &:not(:empty)::after {
      content: ")";
    }
  }

  span.error {
    color: red;
    font-size: 0.8em;
    order: 11;
  }

  &.required::after {
    color: var(--action);
    content: "*";
    order: 1;
    padding-left: 0.25em;
  }
}

/* Target checkbox and radio in forms, not datatables filters */
form,
td {
  input[type="checkbox"],
  input[type="radio"] {
    appearance: auto;
    accent-color: var(--action);

    &:focus {
      outline: auto;
    }
  }
}
form {
  div {
    align-items: center;
    display: flex;
    position: relative;
    width: 48%;

    label {
      width: 100%;
    }
    .password-toggle {
      font-size: 0;
      position: absolute;
      right: 0;
      top: 0;
      transform: translate(-1rem, 3.25rem);
      width: auto;

      &::after {
        content: url(/static/images/icons/icon-hide.svg);
        width: 1rem;
      }

      &.show::after {
        content: url(/static/images/icons/icon-show.svg);
      }

      input[type="checkbox"] {
        appearance: none;
        background: transparent;
        border-color: transparent;
        cursor: pointer;
        margin: 0;
        outline: none;
        position: absolute;
        width: 100%;
      }
    }
  }
}

input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  background-color: white;
  border: 2px solid var(--border);
  flex: 0 0 1em;
  height: 1em;
  margin-right: 0.5em;
  order: -1;
  outline: 0;
  padding: 0;
  transition: 0.5s background-color, 0.5s border-color;
  width: 1em;

  &:checked {
    background-color: var(--action);
    border-color: var(--action);
  }
}
*:not(li) > input[type="radio"] {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 0;
  color: white;
  height: 100%;
  left: 0;
  margin: 0;
  outline: none;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: -2;

  &:checked {
    background-color: var(--active);
    border-color: var(--active);
  }

  &:focus {
    z-index: -1;
  }
}

label ul li {
  align-items: center;
  padding-left: 1em;

  label {
    flex-shrink: 0;
    width: auto;
  }

  input[type="radio"] {
    border-radius: 100%;
  }
}

input[type="color"] {
  height: 2em;
  padding: 0;
  margin-right: calc(100% - 3em);
  width: 3em;
}

input[type="submit"] {
  background: var(--action);
  border-radius: 0.25em;
  border: none;
  color: white;
  font-family: "Schibsted Grotesk", sans-serif;
  font-size: 1em;
  font-weight: 500;
  margin-right: 100%;
  margin-top: 1em;
  padding: 1em;
  transition: 0.5s background;

  &:hover {
    cursor: pointer;
  }

  &:hover,
  &:focus {
    background: var(--action-hover);
  }
}

input[type="button"] {
  background: var(--action);
  border: none;
  color: white;
  font-weight: 500;
  transition: background 0.3s;

  &:hover {
    background: var(--action-hover);
    cursor: pointer;
  }
}

form article {
  box-sizing: border-box;
  flex: 1 0 100%;
}

.dataTables_wrapper {
  .dataTable {
    border: 1px solid var(--border);
    order: 1;

    &.fixedHeader {
      order: 0;
    }
  }
}

/* Important because select width is calculated in px */
.dataTables_wrapper .select2-container--default {
  width: auto !important;
}

/* The scrollbar must be displayed on all tables, even short ones,
   to avoid jumping effect and lags when changing filters.
   !important because overflow: auto; defined by datatable fixedheader */
.dataTables_wrapper .dataTables_scrollBody {
  box-sizing: border-box;
  overflow-y: scroll !important;
}

.dataTables_wrapper .dataTables_scrollHead {
  box-sizing: border-box;
  margin-top: 0.75em;
}

.select2-container.select2-container--default {
  .select2-selection--single .select2-selection__rendered {
    color: var(--text);
  }

  .select2-selection--single
    .select2-selection__rendered
    .select2-selection__placeholder {
    color: var(--text-hue-light-2);
    font-weight: 400;
  }

  .select2-dropdown {
    border: 1px solid var(--border);
    border-radius: 0;
  }

  .select2-results__option[aria-selected="true"] {
    background-color: var(--action-secondary);
  }

  .select2-results__option--highlighted[aria-selected] {
    background-color: var(--action);
  }

  input {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--border);
    color: var(--text);
    font-family: "Schibsted Grotesk", sans-serif;
    font-size: 1em;
    outline: 1px solid transparent;
    transition: 0.5s outline-color, 0.25s border-color;

    &:focus {
      border-color: transparent;
      outline-color: var(--action);
    }
  }
}

/* Tables */

/* This section hides duplicate sorting icons in the .dataTables_scrollBody
to ensure they only appear once in the DataTables headers. */
.dataTables_scrollBody {
  th.sorting::after,
  th.sorting_desc::after,
  th.sorting_asc::after {
    display: none;
  }

  thead .click-zone-container {
    /* can't use `display: none` due to colspan=1 */
    visibility: hidden;
  }
}

table {
  border-collapse: collapse;
  order: 2;
  /* !important because DataTables tries to calculate the width when data are added from AJAX requests */
  width: 100% !important;

  thead {
    color: var(--text);
    text-align: left;

    th {
      font-weight: 600;
      transition: background 0.3s;

      &:hover {
        /* Weasyprint tinycss2 does not support color-mix yet:
           https://github.com/Kozea/tinycss2/issues/65 */
        /* background: color-mix(in srgb, var(--light), black 5%); */
        background: #e5e3e9;
        cursor: pointer;
      }
    }
  }

  td {
    padding: 1em;

    &.click-zone-container {
      padding: 1em 2em;
      position: relative;
    }

    input[type="submit"] {
      background: url(/static/images/icons/icon-delete.svg) no-repeat center;
      border: none;
      display: block;
      font-size: 0;
      height: 1rem;
      width: 1rem;

      &:hover,
      &:focus {
        background: url(/static/images/icons/icon-delete.svg) no-repeat center;
        outline-color: transparent;
      }
    }
  }

  th {
    padding: 1em;
    position: relative;

    &.sorting,
    &.sorting_desc,
    &.sorting_asc {
      &::after {
        bottom: 0;
        content: "";
        display: inline-block;
        height: 100%;
        margin-left: 0.5em;
        position: absolute;
        right: 0.25rem;
        top: 0;
        width: 0.5rem;
      }
    }

    &.sorting:hover {
      &::after {
        opacity: 1;
      }
    }

    &.sorting::after {
      background: url(/static/images/icons/icon-sort_both.svg) no-repeat center;
      opacity: 0;
    }

    &.sorting_desc::after {
      background: url(/static/images/icons/icon-sort_desc.svg) no-repeat center;
      opacity: 1;
    }

    &.sorting_asc::after {
      background: url(/static/images/icons/icon-sort_asc.svg) no-repeat center;
      opacity: 1;
    }
  }

  tr {
    border: 1px solid var(--border);
    border-left: 0;
    border-right: 0;
  }

  a {
    color: var(--action);
    text-decoration: inherit;
  }

  ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  tfoot {
    th {
      font-weight: bold;
      text-align: left;
    }
  }

  form input {
    font-size: 0.75em;
    margin: 0;
    padding: 0.5em;
  }

  &.no-datatable {
    tr:first-of-type {
      border-top: none;
    }

    td {
      padding: 0.5em 0.5em 0.5em 0;

      &:first-of-type {
        overflow-wrap: anywhere;
      }

      &:last-of-type {
        padding-right: 0;
      }

      form input {
        margin: 0;
        padding: 0 0.25em;
      }
    }
  }

  &.stats-table {
    position: relative;
    z-index: 1;

    tbody {
      border: 1px solid var(--border);

      tr {
        border: none;

        &:nth-child(even) {
          background: var(--light);
        }
      }

      tr td {
        box-shadow: 1px 0 0 0 var(--border);
        padding: 1em 0.75em;
        text-align: right;

        &:first-of-type {
          border-left: 1px solid var(--border);
          border-right: none;
          text-align: left;
        }

        dl {
          margin: 0;

          dt {
            font-weight: 600;
            margin-bottom: 0.25rem;
          }

          dd {
            color: var(--text-hue-light);
            font-size: 0.9em;
            margin-left: 0;
          }
        }
      }
    }

    thead {
      &:not(:first-of-type) {
        color: var(--action);
        font-size: 1.5rem;
      }

      tr {
        border: none;
      }

      &.confidential {
        border: 2px solid var(--alert);

        & ~ tbody,
        & ~ thead {
          /* Only set visible borders on the side as Weasyprint does not
             seem to apply border collapsing */
          border-left: 2px solid var(--alert);
          border-right: 2px solid var(--alert);

          tr td:first-of-type,
          tr th {
            padding-left: 1rem;
          }
        }

        & ~ tbody:last-of-type {
          border-bottom: 2px solid var(--alert);
        }

        /* Global stats */
        &:has(input:not(:checked)) + tbody,
        /* Customer stats */
        &:has(input:not(:checked)) ~ thead,
        &:has(input:not(:checked)) + thead ~ tbody {
          visibility: collapse;
        }

        tr {
          /* Weasyprint tinycss2 does not support color-mix yet:
             https://github.com/Kozea/tinycss2/issues/65 */
          /* background: color-mix(in srgb, var(--alert), white 25%); */
          background: #fddad5;

          td:has(#show-confidential) {
            text-align: right;
          }

          td {
            #show-confidential {
              display: none;
            }

            #show-confidential:checked ~ #expand-button {
              display: none;
            }

            #show-confidential:not(:checked) ~ #collapse-button {
              display: none;
            }

            #expand-button,
            #collapse-button {
              color: var(--action);
              cursor: pointer;
              font-size: 0.75em;
              line-height: normal;
              padding: 0;
              text-decoration: underline;
              transition: color, 0.3s;

              &:hover {
                color: var(--action-hover);
              }
            }
          }

          th {
            display: table-cell;
            padding-left: 1em;

            dl {
              color: var(--text);
              font-size: 0.9em;
              margin: 0;

              dt {
                font-size: 1em;

                &::after {
                  background: var(--alert);
                  border-radius: 0.5em;
                  color: white;
                  content: "Confidentiel";
                  display: inline-block;
                  font-size: 0.75em;
                  margin: 0 0.75em;
                  padding: 0.25em 0.5em;
                }
              }

              dd {
                font-size: 0.75em;
                font-weight: 400;
                margin: 0.5em 0 0 0;
              }
            }
          }
        }
      }

      th {
        padding-left: 0;

        &:hover {
          background: none;
          cursor: initial;
        }
      }

      &:first-of-type {
        th:first-of-type {
          background: transparent;
          box-shadow: inset 1px 0 0 0 transparent;
        }

        tr th {
          background: var(--text-hue-light);
          box-shadow: inset 1px 0 0 0 var(--border);
          color: #fff;
          padding: 1em 0.5em;
          position: sticky;
          top: -2em;
          z-index: 1;
          text-align: right;
        }
      }
    }
  }
}

/* Objects */

object {
  margin: 2em 1em 0 0;
  max-width: 30em;
}

img {
  max-width: 100%;
}

/* Pages */

#page-login {
  body > header,
  body > nav {
    display: none;
  }

  body {
    display: flex;
  }

  main {
    align-items: center;
    background: var(--text);
    display: flex;
    flex-grow: 1;
    justify-content: center;

    .login-container {
      background: white;
      border-radius: 1rem;
      flex-direction: column;
      justify-content: center;
      padding: 2rem 4rem;
    }

    header, form, #quick-login {
      max-width: 25rem;
      width: 100%;
    }

    #quick-login {
      padding: 0;
    }

    header {
      margin-bottom: 2rem;
      width: 100%;

      p {
        font-size: 1.1em;
        font-weight: 400;
        margin: 0.5em 0;
      }

      &::before {
        background: url(/static/images/logo.svg) no-repeat left;
        content: "";
        display: block;
        height: 3rem;
        margin-bottom: 2rem;
        width: 100%;
      }

      h1 {
        margin: 0;
        font-size: 26px;
        font-weight: 600;
      }
    }

    form {
      gap: 1rem;
      label, input, div {
        width: 100%;
      }

      .password-toggle {
        width: auto;
      }

      input[type="submit"] {
        margin: 1em 0 0 0;
      }

      a {
        font-size: 0.8em;
        font-weight: 600;
        margin-left: auto;
        margin-top: -0.75rem;
        text-decoration: none;
      }

      & + p {
        display: inline-block;
        font-size: 0.9em;
        text-align: center;
        width: 100%;

        a {
          font-weight: 600;
        }
      }
    }
  }

  footer {
    display: none;
  }
}

#page-login.october main header::before {
  background-image: url(/static/images/logo-octobre-rose.svg);
}

#page-dashboard {
  main {
    display: block;
    padding-bottom: 2em;

    > section {
      height: 100%;

      > aside {
        box-sizing: border-box;
        max-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
      }

      > section {
        display: flex;
        flex-direction: column;
        height: 100%;

        article {
          box-sizing: border-box;
          overflow-y: auto;
          width: 100%;

          h2 {
            background: white;
            margin: -1.5rem 0 0;
            padding: 0.5em 0;
            position: -webkit-sticky;
            position: sticky;
            top: -1.5rem;
            z-index: 1;
          }

          &:last-child {
            margin-bottom: 0;
          }
        }
      }
    }
  }
}

#page-stats,
#page-stats-date,
#page-global-stats,
#page-global-stats-date {
  section {
    &.charts {
      flex-wrap: wrap;
    }

    > h2 {
      margin: 0;
    }
  }
}

/* Color and background transitions can't be apply on
   SVG filters because it's not an animatable value in CSS. */
#svgFilterLight feFlood {
  flood-color: var(--light);
}

#svgFilterDarkblue feFlood {
  flood-color: var(--text);
}

#page-add-customer {
  h2 {
    margin: 1em 0 0 0;
  }
}

#page-invoices-summary {
  .invoice-summary__row--highlight {
    background-color: var(--warning-background);
    border-block: 1px solid var(--warning);
  }

  br {
    margin-bottom: 0.25em;
  }

  td {
    dl {
      display: flex;
      max-width: 12em;

      dd {
        font-size: 1em;
        margin: 0 0 0 auto;
      }
    }
  }
}

#page-add-customer,
.infos-client-container,
#page-planning-add-planning {
  h1 {
    margin: 0;
  }

  article:not(.error-page) {
    column-gap: 3em;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    row-gap: 2em;
    max-width: 50em;

    label {
      font-weight: 600;
      padding: 0;

      &::after {
        color: inherit;
      }

      .select2 {
        background: white;
        border: none;
        font-weight: 400;
        outline: 1px solid var(--border);

        &-container--open {
          outline: 2px solid var(--action);
        }

        &-container--disabled {
          background: var(--light);
          outline-color: var(--light);
        }
      }

      input,
      textarea {
        background: white;
        border: none;
        outline: 1px solid var(--border);
        outline-offset: calc(1px * -1);
        padding: 0.5em 0.75em;

        &[readonly] {
          background: var(--light);
          outline-color: var(--light);
        }

        &:focus {
          outline: 2px solid var(--action);
          outline-offset: calc(2px * -1);
        }
      }

      input[type="checkbox"] {
        outline-width: 2px;
        border-radius: 3px;
      }
    }

    h2 {
      grid-column: span 6;
      margin-bottom: 0;
    }

    label {
      width: auto;
      &:has(input[type="checkbox"]) {
        cursor: pointer;
        font-weight: 400;
      }

      &:has(.form--large) {
        grid-column: span 6;
      }

      &:has(.form--medium) {
        grid-column: span 3;
      }

      &:has(.form--small) {
        grid-column: span 2;
      }

      &:has(.form--two-thirds) {
        grid-column: span 4;
      }
    }
  }

  .floating-submit-button {
    grid-column: span 6;
    padding: 0.5em 0;
  }
}

#page-planning-add-planning {
  article:not(.error-page) {
    column-gap: 1em;
    max-width: 30em;

    input[type="submit"] {
      grid-column: span 3;
      margin-right: inherit;
    }

    /* Specific style for input days */
    label:has(input[type="checkbox"]:not(#delete)) {
      padding: 0.25em 1em;
      position: relative;
      width: fit-content;

      input {
        appearance: none;
        background: transparent;
        bottom: 0;
        height: 100%;
        left: 0;
        margin: 0;
        outline-color: var(--border);
        outline-width: 1px;
        padding: 0;
        position: absolute;
        right: 0;
        top: 0;
        width: 100%;

        &:hover {
          cursor: pointer;
        }

        &:focus {
          outline-offset: calc(1px * -1);
          outline-width: 1px;
        }

        &:focus-visible {
          outline: auto;
        }

        &:checked {
          outline-color: var(--action);
          outline-width: 2px;
        }
      }
    }
  }
}

#page-customer-planning,
#page-customer-planning-date,
#page-planning-customer,
#page-planning-customer-date {
  dialog {
    background: white;
    border: none;
    border-radius: 0.5em;
    padding: 1.5em 2em;
    width: 25%;

    &::backdrop {
      background: rgba(0, 0, 0, 0.9);
    }

    p {
      &#modal-title {
        font-size: 1.3em;
        font-weight: bold;
        margin-top: 0;
      }
    }

    div {
      display: flex;
      gap: 1em;
      justify-content: flex-end;
      margin-top: 1em;
      padding: 0;
      width: auto;

      button {
        border: none;
        border-radius: 0.25em;
        color: white;
        font-family: "Schibsted Grotesk", sans-serif;
        font-size: 1em;
        font-weight: bold;
        height: fit-content;
        justify-content: center;
        padding: 0.75em 1em;
        transition: background 0.3s;

        &:focus-visible {
          outline: none;
        }

        &:hover {
          cursor: pointer;
        }

        &#cancel {
          background: white;
          border: 1px solid var(--border);
          color: var(--text);
          &:hover {
            /* Weasyprint tinycss2 does not support color-mix yet:
               https://github.com/Kozea/tinycss2/issues/65 */
            /* background: color-mix(in srgb, white, black 8%); */
            background: #eaeaea;
          }
        }

        &#confirm {
          background: var(--stop);
          border: 1px solid transparent;
          color: white;
          &:hover {
            /* Weasyprint tinycss2 does not support color-mix yet:
               https://github.com/Kozea/tinycss2/issues/65 */
            /* background: color-mix(in srgb, var(--stop), black 8%); */
            background: #b1252a;
          }
        }
      }
    }
  }
}

#page-report {
  .view-print {
    display: none;
  }

  .metrics {
    background: var(--light-blue);
    border-radius: 0.5em;
    flex-wrap: wrap;
    padding: 1em 2em;

    h2 {
      flex: 1 100%;
      font-size: 1.5em;
      font-weight: 600;
      margin: 0;
    }

    p {
      font-weight: 500;
      margin: 0.5em 0;
    }

    div {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 2em;

      dl {
        background: #fff;
        box-shadow:
          3px 6px 20px rgba(0, 0, 0, 0.04),
          0 1px 2px rgba(0, 0, 0, 0.05);
        border-radius: 0.5em;
        display: flex;
        flex-wrap: wrap;
        padding: 1em;

        &:last-of-type {
          dt:nth-of-type(2) {
            font-size: 0.9em;
            font-weight: 400;
          }
        }

        &:first-of-type {
          dd {
            background: var(--close-session);
            border-radius: 0.25em;
            color: var(--close-session-text);
            padding: 0.25em 0.5em;

            &::before {
              content: "▼";
              font-size: 0.5em;
              vertical-align: middle;
            }
          }
        }

        dt {
          font-weight: 500;
          flex: 1 100%;

          &:last-of-type {
            margin-bottom: 1em;
          }
        }

        dd {
          font-weight: 700;
          font-size: 1.25em;
          letter-spacing: -0.025em;
          margin: auto 0 0 0;
        }
      }
    }
  }

  .report-details {
    display: grid;
    grid-template-areas: "main aside";
    grid-template-columns: 80% 1fr;

    @media (max-width: 1650px) {
      grid-template-areas: "aside" "main";
      grid-template-columns: 1fr;

      h2 {
        margin-top: 0;
      }
    }

    .invoices-table {
      font-size: 0.95em;
      grid-area: main;

      h2 {
        font-weight: 600;
      }

      input[type="search"] {
        margin-bottom: 1em;
      }

      td {
        position: relative;

        a {
          background: url(/static/images/icons/icon-more.svg) no-repeat center;
          font-size: 0;
          height: 100%;
          left: 0;
          position: absolute;
          top: 0;
          width: 100%;

          &::after {
            transition: none;
          }

          &:hover {
            background: url(/static/images/icons/icon-more.svg) no-repeat center
              #f2effb;
            border-color: #f2effb;

            &::after {
              background: var(--text);
              border-radius: 0.25em;
              bottom: -2.5em;
              color: var(--light);
              content: "Ligne d'intervention";
              font-size: 12px;
              height: min-content;
              padding: 0.5em;
              position: absolute;
              right: 0;
              transform: none;
              transition: none;
              width: min-content;
              z-index: 10;
            }
          }
        }

        span {
          border-radius: 0.25em;
          box-decoration-break: clone;
          line-height: 1.5;
          padding: 0.25em;

          &.rejection-reason {
            background: var(--information-light);
          }

          &.action-value {
            background: var(--light-green);
          }
        }
      }
    }

    aside {
      border: none;
      grid-area: aside;
      margin-right: 0;
      padding-right: 0;
      width: auto;

      div {
        border: 1px solid var(--border);
        border-radius: 0.5em;
        margin: 0 0 1em 0;
        padding: 0.75em 1em;

        h3 {
          font-size: 1.1em;
          font-weight: 600;
          margin-bottom: 0.5em;
        }

        ul {
          font-size: 0.95em;
          gap: 0.5em;
          margin: 0;
          padding-left: 1em;
        }

        &.duplicate-invoices {
          background: var(--warning-background);
          border-color: var(--warning-background);
          border-left: 3px solid var(--warning);
          border-top-left-radius: 0;
          border-bottom-left-radius: 0;

          h3 {
            color: var(--warning);
          }
        }

        &.observations {
          background: var(--information-light);
          border-color: var(--information-light);
          border-left: 3px solid var(--information);
          border-top-left-radius: 0;
          border-bottom-left-radius: 0;

          h3 {
            color: var(--information);
          }
        }

        &.interventions-summary {
          .intervention-item {
            border: none;
            border-bottom: 1px solid var(--border);
            border-radius: 0;
            padding: 0;

            &:last-of-type {
              border-bottom: none;
              margin-bottom: 0;
            }

            ul {
              display: flex;
              flex-wrap: wrap;
              font-size: 1em;
              justify-content: space-between;
              list-style: none;
              padding-left: 0;

              li {
                &:last-of-type {
                  flex: 1 100%;
                }

                &:first-of-type {
                  font-size: 1.1em;
                  font-weight: 500;
                }
              }
            }

            dl {
              align-items: center;
              display: grid;
              font-size: 0.95em;
              gap: 0.25em;
              grid-template-columns: auto 1fr;
              margin-bottom: 0.5em;

              dt {
                font-weight: 400;
                margin: 0;
                padding: 0;
              }

              dd {
                text-align: right;
              }
            }

            a {
              display: block;
              font-size: 0.95em;
              margin: 0.5em 0;
            }
          }
        }

        &.intervention-action {
          ul {
            display: flex;
            flex-wrap: wrap;
            list-style: none;
            padding-left: 0;

            li {
              background: var(--information-light);
              border-radius: 0.25em;
              padding: 0.25em;
            }
          }
        }
      }

      @media (max-width: 1650px) {
        display: grid;
        gap: 0 1em;
        grid-template-columns: repeat(5, 1fr);
        padding: 1em 0;

        div {
          margin-bottom: 0;
        }
      }
    }
  }
}
