/* @import url("https://fonts.googleapis.com/css2?family=League+Spartan:wght@100..900&display=swap"); */
:root {
  --venetian-nights: #7c5dfa;
  --forgotten-purple: #9277ff;
  --kon: #1e2139;
  --royal-curtsy: #252945;
  --stotic-white: #dfe3fa;
  --papilio-argeotus: #888eb0;
  --true-lavender: #7e88c3;
  --ruined-smores: #0c0e16;
  --khmer-curry: #ec5757;
  --american-pink: #ff9797;
  --zhēn-zhū-bái-pearl: #f8f8fb;
  --river-styx: #141625;
  --carbon-blue: #373b53;
  --independence: #494e6e;
  --sapphire-blue: #0057d9;
  --paid: #33d69f;
  --pending: #ff8f00;
  --draft: light-dark(var(--carbon-blue), var(--stotic-white));

  --animated-color: hsl(from light-dark(white, black) h s l / 0);

  color-scheme: var(--color-scheme, light);
  & .light-mode {
    display: block;
  }
  & .dark-mode {
    display: none;
  }

  &:has(input[name="theme"]:checked) {
    --color-scheme: dark;
    & .light-mode {
      display: none;
    }
    & .dark-mode {
      display: block;
    }
  }
  scrollbar-color: light-dark(var(--stotic-white), var(--royal-curtsy))
    transparent;
  @media (prefers-color-scheme: dark) {
    &:has(input[name="theme"]:checked) {
      --color-scheme: dark;
      --draft: var(--stotic-white);
      & .light-mode {
        display: none;
      }
      & .dark-mode {
        display: block;
      }
    }
  }

  @media screen and (prefers-reduced-motion: reduce), (update: slow) {
    transition-duration: 0s;
  }
}

.progress-circle {
  display: block;
  margin: auto;
  width: 0.94rem;
  height: 0.94rem;
  animation: spin 1s linear infinite;
  border-radius: 50%;
  border: 4.75px solid white;
  border-top: 4.75px solid var(--sapphire-blue);
}
/* Full-screen overlay */
#overlay,
#share-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999; /* Ensure it stays above other elements */
  visibility: hidden; /* Hide by default */
  /* transition: opacity 0.5s ease, visibility 0.5s ease; */
}

/* Spinner styles */
.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid white; /* Light background */
  border-top: 5px solid var(--sapphire-blue); /* Blue spinner */
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes scroll-appear {
  from {
    --animated-color: transparent;
  }
  to {
    --animated-color: hsl(from black h s l / 0.1);
  }
}

@font-face {
  font-family: "League Spartan";
  src: url("../assets/fonts/league-spartan-v11-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "League Spartan";
  src: url("../assets/fonts/league-spartan-v11-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.league-spartan-medium {
  font-family: "League Spartan", sans-serif;
  font-optical-sizing: auto;
  font-weight: 500;
  font-style: normal;
}
.league-spartan-bold {
  font-family: "League Spartan", sans-serif;
  font-optical-sizing: auto;
  font-weight: 700;
  font-style: normal;
}
html {
  height: 100%;
  margin: 0 auto;
  max-width: 90rem;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  transition: all 1s ease;

  /* overflow: hidden; */

  background-color: light-dark(var(--zhēn-zhū-bái-pearl), var(--river-styx));

  &:has(#new-invoice-dialog[open], #edit-invoice-dialog[open]) {
    overflow: hidden;
  }
}

.bill-from-section,
.bill-to-section {
  display: grid;
  grid-template-areas:
    "header ."
    "addy addy"
    "city post-code"
    "country country";
  row-gap: 1.563rem;
  column-gap: clamp(1.438rem, calc(1.378rem + 0.254vw), 1.5rem);

  & .section-header {
    grid-area: header;
    font-size: 0.9375rem;
    line-height: 1;
    letter-spacing: -0.015625rem;
    color: var(--venetian-nights);

    padding-block-start: clamp(1.375rem, calc(-0.056rem + 6.107vw), 2.875rem);
  }

  & .addy {
    grid-area: addy;
  }
  & .city {
    grid-area: city;
  }
  & .postal-code {
    grid-area: post-code;
  }
  & .country {
    grid-area: country;
  }
}
.bill-to-section {
  grid-template-areas:
    "header ."
    "name name"
    "email email"
    "addy addy"
    "city post-code"
    "country country";

  & .client-name {
    grid-area: name;
  }

  & .client-email {
    grid-area: email;
  }
}
.control-btns-cont {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block-end: 1.625rem;
}

.copy-btn {
  position: relative;

  & .copy-feedback {
    position: absolute;
    bottom: -2rem;
    /* right: 0; */
    left: -80%;
    visibility: hidden;
    background-color: light-dark(var(--kon), white);
    color: light-dark(white, var(--kon));
    padding: 0.5rem;
    border-radius: 0.5rem;
  }
}
#delete-dialog,
#profile-dialog,
#share-dialog,
#response-dialog {
  border: 0;
  margin: auto;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 0.5rem;
  background-color: light-dark(white, var(--kon));
  padding-inline: clamp(2rem, calc(1.046rem + 4.071vw), 3rem);
  padding-block: clamp(2.125rem, calc(1.111rem + 4.326vw), 3.188rem)
    clamp(2rem, calc(1.046rem + 4.071vw), 3rem);

  width: clamp(20.438rem, calc(11.313rem + 38.931vw), 30rem);

  &::backdrop {
    background-color: hsl(from black h s l / 0.5);
  }

  & .profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    & .close-btn {
      background-color: transparent;
      padding: 0;
      width: max-content;

      &:hover > svg {
        color: var(--venetian-nights);
      }
    }
  }

  & #profile-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;

    & label {
      cursor: pointer;
      position: relative;
      text-align: center;
      &:hover {
        color: var(--venetian-nights);
      }

      & input[type="file"] {
        width: 100%;
        opacity: 0;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        padding-block: 0;
        &:user-invalid {
          background-color: red;
        }
      }

      &:has(input[name="username"]) {
        display: flex;
        align-items: center;
        width: 100%;
      }
    }

    & .profile-btn-cont {
      display: flex;
      justify-content: space-between;
      width: 100%;
    }
    & .logout {
      background-color: var(--khmer-curry);
      width: 5.7131rem;
    }
    & input[name="username"] {
      flex: 1;

      &:user-invalid {
        outline: var(--khmer-curry) solid 1px;
      }

      &:user-valid {
        outline: green solid 1px;
      }
    }
  }

  & img {
    border-radius: 50%;
    margin-inline: auto;
    margin-block-end: 1rem;
  }
  & button {
    line-height: 1;
    font-size: 0.938rem;
    letter-spacing: -0.016rem;
    border-radius: 1.5rem;
    width: 8.658rem;
    text-align: center;
    /* padding-inline: 1.5rem; */
    padding-block: 1.125rem 0.938rem;
    color: white;
    background-color: var(--venetian-nights);

    &:hover {
      cursor: pointer;
    }
  }
  & h1 {
    font-size: 1.5rem;
    letter-spacing: -0.031rem;
    line-height: 1.33;
    color: light-dark(var(--ruined-smores), white);

    margin-block-end: clamp(0.5rem, calc(0.261rem + 1.018vw), 0.75rem);
  }

  & p {
    margin-block-end: clamp(0.875rem, calc(1.852rem + -2.036vw), 1.375rem);
    font-size: 0.813rem;
    letter-spacing: -0.006rem;
    line-height: 1.69;
    color: var(--papilio-argeotus);
  }
  & .btn-cont {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;

    & button {
      line-height: 1;
      font-size: 0.938rem;
      letter-spacing: -0.016rem;
      border-radius: 1.5rem;
      /* padding-inline: 1.5rem; */
      padding-block: 1.125rem 0.938rem;

      &:hover {
        cursor: pointer;
      }
    }

    & .cancel-btn {
      background-color: light-dark(#f9fafe, var(--royal-curtsy));
      color: light-dark(var(--true-lavender), var(--stotic-white));
      flex: 1;
    }

    & .delete-btn {
      flex: 1;
      background-color: var(--khmer-curry);
      color: white;
    }
  }
}

div.edit-btns {
  border-radius: 0.5rem;
  & > button {
    display: none;
  }
}
.edit-btns {
  padding-inline: clamp(1.5rem, calc(1.023rem + 2.036vw), 2rem);
  padding-block: clamp(1.25rem, calc(1.739rem + -1.018vw), 1.5rem)
    clamp(1.25rem, calc(2.105rem + -1.781vw), 1.688rem);
  background-color: light-dark(white, var(--kon));
  display: flex;
  gap: clamp(0.438rem, calc(0.378rem + 0.254vw), 0.5rem);
  font-size: 0.938rem;
  text-align: center;
  line-height: 1;
  letter-spacing: -0.016rem;
  box-shadow: 0px -10px 50px 50px hsl(from var(--animated-color) h s l / 0.1);

  position: sticky;
  bottom: 0;

  & button {
    border-radius: 1.5rem;

    padding-block: 1.125rem 0.938rem;
    /* padding-inline: 1.5rem 1.438rem; */
    &:hover {
      cursor: pointer;
    }
  }

  & button.edit-btn {
    color: light-dark(var(--true-lavender), var(--stotic-white));
    background-color: light-dark(#f9fafe, var(--royal-curtsy));

    width: 4.563rem;
    &:hover {
      background-color: light-dark(var(--stotic-white), white);
      color: var(--true-lavender);
      cursor: pointer;
    }
  }
  & button.delete-btn {
    margin-inline-start: auto;
    color: white;
    background-color: var(--khmer-curry);
    width: 5.563rem;

    &:hover {
      background-color: var(--american-pink);
    }
  }

  & button.mark-btn {
    color: white;
    background-color: var(--venetian-nights);
    width: clamp(8.188rem, calc(10.386rem + -4.58vw), 9.313rem);

    &:hover {
      background-color: var(--forgotten-purple);
    }
  }

  & .status-cont {
    display: flex;
    align-items: center;

    flex: 1;
  }

  & .hide {
    display: none;
  }
  &.hide {
    display: none;
  }
}

.filter-status-cont {
  position: relative;
  color: light-dark(var(--ruined-smores), white);
  font-size: 0.938rem;
  line-height: 1;
  letter-spacing: -0.016rem;
  padding-inline: 2.5rem clamp(1.159rem, calc(-0.121rem + 5.461vw), 2.5rem);
  width: max-content;

  & .filter-status-input-lab {
    &:hover {
      cursor: pointer;
    }
    & input[type="checkbox"] {
      display: none;
    }

    &::after {
      content: "";
      top: 0;
      bottom: 0;
      margin-inline-start: clamp(0.75rem, calc(0.631rem + 0.509vw), 0.875rem);
      width: 0.65rem;
      height: 0.65rem;
      display: inline-block;
      vertical-align: middle;
      background-position-y: center;
      background-image: url(../assets/icon-arrow-down.svg);
      background-repeat: no-repeat;
    }

    &:has(input:checked) + .filter-status-menu {
      display: flex;
    }
  }
  & .filter-status-input-lab:has(input:checked) {
    &::after {
      transform: rotate(180deg);
    }
  }

  & .filter-status-menu {
    position: absolute;
    padding: 0;
    top: 1.3125rem;
    left: 0;
    right: 0;
    list-style: none;
    background-color: light-dark(white, var(--royal-curtsy));
    border-radius: 0.5rem;
    display: none;
    flex-direction: column;
    padding-inline-start: 1.5rem;
    padding-block: 1.5rem;
    gap: 0.9375rem;

    & label {
      &:before {
        content: "";
        width: 1rem;
        height: 1rem;
        margin-right: 0.8125rem;
        display: inline-block;
        background-color: light-dark(var(--stotic-white), var(--kon));
        border-radius: 0.125rem;
        vertical-align: middle;
      }
      &:hover {
        cursor: pointer;
        &::before {
          border: 1px solid var(--venetian-nights);
        }
      }
      &:has(input:checked) {
        &::before {
          background-image: url(../assets/icon-check.svg);
          background-repeat: no-repeat;
          background-position: center;
          background-color: var(--venetian-nights);
        }
      }
      & input {
        display: none;
      }
    }
  }
}
.header {
  background-color: var(--carbon-blue);
  display: flex;

  & .logo-cont {
    background-color: var(--venetian-nights);

    margin-inline-end: auto;
    position: relative;

    padding-inline: clamp(1.375rem, calc(1.256rem + 0.509vw), 1.5rem);
    padding-block: clamp(1.438rem, calc(1.318rem + 0.509vw), 1.563rem);
    border-top-right-radius: 1.25rem;
    border-bottom-right-radius: 1.25rem;
    overflow: hidden;
    z-index: 0;

    & img {
      width: clamp(2rem, calc(1.523rem + 2.036vw), 2.5rem);
    }
    & .logo-bg {
      position: absolute;
      background-color: var(--forgotten-purple);
      width: 100%;
      height: 100%;
      z-index: -1;
      left: 0;
      right: 0;
      bottom: -50%;

      border-top-left-radius: 1.25rem;
      border-bottom-left-radius: 1.25rem;
    }
  }

  & .theme-toggle {
    align-self: center;
    padding-inline: clamp(1.5rem, calc(1.023rem + 2.036vw), 2rem);
    color: var(--true-lavender);
    &:hover {
      cursor: pointer;
      color: var(--stotic-white);
    }
  }

  & .profile-pic-cont {
    padding-inline: clamp(1.5rem, calc(1.023rem + 2.036vw), 2rem);
    padding-block: clamp(1.25rem, calc(1.011rem + 1.018vw), 1.5rem);
    border-left: 1px solid var(--independence);

    & img {
      width: 2rem;
      border-radius: 50%;
    }

    &:hover {
      cursor: pointer;
    }
  }
  & input[type="checkbox"] {
    display: none;
  }
}

.header-cont {
  background-color: light-dark(white, var(--river-styx));
}

.hide-mobile {
  display: none;
}
.go-back-btn {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  font-size: 0.9375rem;
  line-height: 1;
  letter-spacing: -0.015625rem;
  color: light-dark(var(--ruined-smores), white);
  /* padding-block-end: 1.625rem; */
  padding-inline-start: clamp(1.5rem, calc(-0.408rem + 8.142vw), 3.5rem);
  padding-inline-end: clamp(1.188rem, calc(-0.721rem + 8.142vw), 3.188rem);

  &:hover {
    cursor: pointer;
    color: light-dark(var(--true-lavender), var(--papilio-argeotus));
  }
}
.go-back-btn-invoice-page {
  padding-inline: 0;
}
.individual-invoice {
  margin-block-start: clamp(1rem, calc(0.523rem + 2.036vw), 1.5rem);
  padding-inline: clamp(1.5rem, calc(1.023rem + 2.036vw), 2rem);
  padding-block: clamp(1.5rem, calc(1.023rem + 2.036vw), 2rem);
  border-radius: 0.5rem;
  background-color: light-dark(white, var(--kon));

  & .invoice-info {
    display: grid;

    grid-template-areas:
      "title title"
      "addy addy"
      "date bill-to"
      "due bill-to"
      "email email";
    grid-template-columns: repeat(2, 1fr);
    row-gap: 1.875rem;
    font-size: 0.813rem;
    letter-spacing: -0.006rem;
    line-height: 1.15;
    padding-block-end: clamp(2.375rem, calc(1.838rem + 2.29vw), 2.938rem);

    color: light-dark(var(--true-lavender), var(--stotic-white));
    & > div {
      display: grid;
      row-gap: 0.8125rem;

      & > p {
        font-size: 0.9375rem;
        line-height: 1.33;
        letter-spacing: -0.015625rem;
        color: light-dark(var(--ruined-smores), white);
      }
    }
    & .invoice-title {
      grid-area: title;
      align-content: center;
      & > p {
        font-size: 0.813rem;
        letter-spacing: -0.006rem;
        line-height: 1.15;
        color: light-dark(var(--true-lavender), var(--stotic-white));
      }
    }

    & address {
      line-height: 1.38;
      font-style: normal;
    }
    & .user-addy {
      grid-area: addy;
    }

    & .invoice-date {
      grid-area: date;
    }
    & .payment-due {
      grid-area: due;
    }

    & .bill-to {
      grid-area: bill-to;

      & > p {
        margin-block-end: clamp(-0.562rem, calc(-0.861rem + 1.272vw), -0.25rem);
      }
    }

    & .email {
      grid-area: email;
    }

    & .invoice-id {
      margin-block-end: clamp(-0.562rem, calc(-0.861rem + 1.272vw), -0.25rem);

      font-size: 0.938rem;
      line-height: 1;
      letter-spacing: -0.016rem;
      color: light-dark(var(--ruined-smores), white);

      & span {
        margin-inline-end: -0.25rem;
        color: light-dark(var(--true-lavender), var(--papilio-argeotus));
      }
    }
  }

  & .invoice-items {
    background-color: light-dark(#f9fafe, var(--royal-curtsy));

    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    & .invoice-table-cont {
      display: grid;
      row-gap: 1.5rem;
      padding-inline: clamp(1.5rem, calc(1.023rem + 2.036vw), 2rem);
      padding-block: clamp(1.563rem, calc(1.085rem + 2.036vw), 2.063rem)
        clamp(1.438rem, calc(0.483rem + 4.071vw), 2.438rem);
      font-size: 0.938rem;
      letter-spacing: -0.016rem;
      line-height: 1;
      color: light-dark(var(--ruined-smores), white);
    }
    & .invoice-item {
      display: grid;
      grid-template-areas:
        "name name total"
        "qty price total";
      grid-template-columns: max-content 1fr;
      align-items: center;
      row-gap: 0.5rem;
      column-gap: 0.25rem;

      & .name {
        grid-area: name;
      }
      & .qty {
        grid-area: qty;
        color: light-dark(var(--true-lavender), var(--papilio-argeotus));
      }
      & .price {
        grid-area: price;
        color: light-dark(var(--true-lavender), var(--papilio-argeotus));
      }
      & .total {
        grid-area: total;
      }
    }
    & .invoice-header {
      display: none;
      font-size: 0.813rem;
      letter-spacing: -0.006rem;
      line-height: 1.38;
      color: light-dark(var(--true-lavender), var(--stotic-white));
    }

    & .amount-due-cont {
      padding-inline: clamp(1.5rem, calc(1.023rem + 2.036vw), 2rem);
      padding-block: clamp(1.625rem, calc(1.565rem + 0.254vw), 1.688rem)
        clamp(1.313rem, calc(1.435rem + -0.254vw), 1.375em);
      display: flex;
      justify-content: space-between;
      background-color: light-dark(var(--carbon-blue), var(--ruined-smores));
      color: white;
      border-bottom-left-radius: 0.5rem;
      border-bottom-right-radius: 0.5rem;
      align-items: center;
      & .amount-due-header {
        font-size: 0.813rem;
        line-height: 1.38;
        letter-spacing: -0.006rem;
      }
      & .amount-due {
        font-size: 1.5rem;
        line-height: 1.33;
        letter-spacing: -0.031rem;
      }
    }
  }
}
input {
  min-width: 0;
  background-color: light-dark(white, var(--kon));
  border: 1px solid light-dark(var(--stotic-white), var(--royal-curtsy));
  color: light-dark(var(--ruined-smores), white);
  border-radius: 0.25rem;
  font-size: 0.9375rem;
  line-height: 1;
  letter-spacing: -0.015625rem;
  text-indent: 1.25rem;
  padding-block: 1.125rem 0.9375rem;

  &:hover {
    cursor: pointer;
    outline: var(--venetian-nights) solid 1px;
  }
  &:read-only,
  :disabled {
    color: var(--true-lavender);
    pointer-events: none;

    &:hover {
      outline: none;
    }
  }
}
.invoices {
  &:has(> *:not(.hide)) + .no-invoices-con {
    display: none;
  }

  & a {
    text-decoration: none;
    color: inherit;

    &:visited {
      color: inherit;
    }
  }
  &:has(> .hide) {
    display: none; /* Hide if all children have the .hide class */
  }
  &:has(> *:not(.hide)) {
    display: grid; /* Show if any child does NOT have the .hide class */
    gap: 1rem;
    padding-block-start: clamp(2rem, calc(0.628rem + 5.852vw), 3.438rem);
  }
  & .hide {
    display: none;
  }

  & .invoice {
    align-items: center;
    border-radius: 0.5rem;
    padding-inline: 1.5rem;
    padding-block: clamp(1rem, calc(2.099rem + -2.29vw), 1.563rem)
      clamp(1rem, calc(1.733rem + -1.527vw), 1.375rem);
    grid-template-columns: repeat(2, 1fr);
    background-color: light-dark(white, var(--kon));
    display: grid;
    grid-template-areas:
      "id user"
      "due status"
      "amount status";
    border: 1px solid transparent;

    &:hover {
      cursor: pointer;
      border: 1px solid var(--venetian-nights);
    }

    & .invoice-id {
      margin-block-end: 1.5rem;
      grid-area: id;
      font-size: 0.938rem;
      line-height: 1;
      letter-spacing: -0.016rem;
      color: light-dark(var(--ruined-smores), white);

      & span {
        margin-inline-end: -0.25rem;
        color: light-dark(var(--true-lavender), var(--papilio-argeotus));
      }
    }
    & .invoice-user {
      text-transform: capitalize;
      margin-block-end: 1.5rem;
      grid-area: user;
      text-align: right;
      font-size: 0.813rem;
      line-height: 1.15;
      letter-spacing: -0.006rem;
      color: light-dark(#858bb2, white);
    }
    & .due-date {
      grid-area: due;
      font-size: 0.813rem;
      line-height: 1.15;
      letter-spacing: -0.006rem;
      color: light-dark(var(--true-lavender), var(--stotic-white));
    }
    & .amount {
      grid-area: amount;
      font-size: 0.9375rem;
      line-height: 1.6;
      letter-spacing: -0.016rem;
    }
    & .status-cont {
      grid-area: status;
      display: flex;
      align-items: center;
      gap: 1.25rem;
    }
  }
}

.invoice-date-section {
  display: grid;
  grid-template-areas:
    "date"
    "net"
    "desc";
  row-gap: 1.563rem;
  column-gap: clamp(1.438rem, calc(1.378rem + 0.254vw), 1.5rem);
  padding-block-start: clamp(2.563rem, calc(2.085rem + 2.036vw), 3.063rem);
  & input[type="date"] {
    padding-inline-start: 1.25rem;
    padding-inline-end: 1rem;

    &::-webkit-datetime-edit {
      text-indent: 0;
    }

    &:hover {
      cursor: pointer;
      accent-color: green;
    }
  }

  & input[type="text"] {
    &::placeholder {
      color: light-dark(var(--ruined-smores), white);
    }
  }

  & .date {
    grid-area: date;
  }

  & .net {
    grid-area: net;
    position: relative;
    & input {
      display: none;
    }
    & label:has(input:checked) + #net-menu {
      display: block;
    }

    & label {
      cursor: pointer;

      & .label-name {
        display: flex;

        justify-content: space-between;
      }
    }
    & .net-span {
      display: flex;
      background-color: light-dark(white, var(--kon));
      border: 1px solid light-dark(var(--stotic-white), var(--royal-curtsy));
      color: light-dark(var(--ruined-smores), white);
      border-radius: 0.25rem;
      font-size: 0.9375rem;
      padding-block: 1.125rem 0.9375rem;
      text-indent: 1.25rem;
      align-items: center;
      justify-content: space-between;
      padding-inline-end: 1rem;

      &:hover {
        border: 1px solid var(--venetian-nights);
      }

      &::after {
        content: "";
        background-image: url(../assets/icon-arrow-down.svg);
        top: 0;
        bottom: 0;
        right: 0;

        background-repeat: no-repeat;
        width: 0.65rem;
        height: 0.65rem;
        display: inline-block;
        vertical-align: middle;
      }

      &:has(input:checked)::after {
        transform: rotate(180deg);
      }
    }

    & #net-menu {
      width: 100%;
      list-style: none;
      padding: 0;
      position: absolute;
      bottom: -12.25rem;
      border-radius: 0.5rem;
      display: none;
      color: light-dark(var(--ruined-smores), white);
      background-color: light-dark(white, var(--royal-curtsy));
      box-shadow: 0px 10px 20px 0px
        light-dark(hsl(from #48549f h s l / 0.25), hsl(from black h s l / 0.25));

      & label {
        padding-inline: 1.5rem;
        padding-block: 1rem 0.938rem;
        font-size: 0.938rem;
        line-height: 1;
        letter-spacing: -0.016rem;
        border-bottom: 1px solid var(--kon);

        &:hover {
          cursor: pointer;
          color: var(--venetian-nights);
        }
      }
    }
  }

  & .desc {
    grid-area: desc;
  }
}

.invoice-title-cont {
  margin-inline-end: auto;

  color: light-dark(var(--papilio-argeotus), var(--stotic-white));
  font-size: 0.813rem;
  letter-spacing: -0.006rem;
  line-height: 1.15;

  & .invoice-title {
    color: light-dark(var(--ruined-smores), white);
    font-size: clamp(1.5rem, calc(0.784rem + 3.053vw), 2.25rem);
    letter-spacing: clamp(-0.071rem, calc(-0.024rem + -0.097vw), -0.047rem);
    line-height: 0.92;
  }
}

.new-invoice-btn {
  display: flex;
  align-items: center;
  background-color: var(--venetian-nights);
  color: light-dark(white, white);
  border-radius: 1.5rem;
  padding-inline: clamp(0.375rem, calc(0.256rem + 0.509vw), 0.5rem)
    clamp(0.938rem, calc(0.818rem + 0.509vw), 1.063rem);
  padding-block: clamp(0.375rem, calc(0.256rem + 0.509vw), 0.5rem);
  gap: 0.5rem;
  font-size: 0.938rem;
  letter-spacing: -0.016rem;
  line-height: 1;
  .img-span {
    padding: 0.688rem;
    border-radius: 50%;
    background-color: white;
    & img {
      min-width: 0.6875rem;
    }
  }

  &:hover {
    cursor: pointer;
    background-color: var(--forgotten-purple);
  }
}
#new-invoice-dialog[open],
#edit-invoice-dialog[open] {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  margin: 0;
  height: 100%;
  min-width: 100%;
  max-height: 100vh;
  max-height: 100svh;
  background-color: transparent;
  background: linear-gradient(
    to right,
    light-dark(white, var(--river-styx)) 15%,
    transparent 15%
  );

  & .header {
    position: sticky;
    top: 0;
  }
  & label {
    display: grid;
    color: light-dark(var(--true-lavender), var(--papilio-argeotus));
    font-size: 0.8125rem;
    letter-spacing: -0.00625rem;
    line-height: 1.15;
    gap: 0.5625rem;

    &:has(:user-invalid) {
      color: var(--khmer-curry);
      & .label-name {
        display: flex;
        justify-content: space-between;
      }
      & .error-text::after {
        content: "can't be empty";
      }
      & input {
        outline: var(--khmer-curry) solid 1px;
      }
    }
  }
  & input {
    min-width: 0;
    background-color: light-dark(white, var(--kon));
    border: 1px solid light-dark(var(--stotic-white), var(--royal-curtsy));
    color: light-dark(var(--ruined-smores), white);
    border-radius: 0.25rem;
    font-size: 0.9375rem;
    line-height: 1;
    letter-spacing: -0.015625rem;
    text-indent: 1.25rem;
    padding-block: 1.125rem 0.9375rem;

    &:hover {
      cursor: pointer;
      outline: var(--venetian-nights) solid 1px;
    }
    &:read-only,
    :disabled {
      color: var(--true-lavender);
      pointer-events: none;

      &:hover {
        outline: none;
      }
    }
  }

  & .form-cont {
    display: flex;
    flex-direction: column;
    background-color: light-dark(white, var(--river-styx));
    flex: 1;

    overflow: auto;
    padding-block-start: clamp(2.063rem, calc(0.512rem + 6.616vw), 3.688rem);
    scrollbar-color: light-dark(var(--stotic-white), var(--royal-curtsy))
      transparent;
    animation: scroll-appear;
    animation-timeline: scroll(self);
    animation-range: 0 100%;
    color: var(--animated-color);
    scrollbar-gutter: stable;

    &::-webkit-scrollbar-thumb {
      color: light-dark(var(--stotic-white), var(--royal-curtsy));
    }

    &::-webkit-scrollbar-track {
      color: transparent;
    }

    & h3 {
      padding-inline-start: clamp(1.5rem, calc(-0.408rem + 8.142vw), 3.5rem);
      padding-inline-end: clamp(1.188rem, calc(-0.721rem + 8.142vw), 3.188rem);
      color: light-dark(var(--ruined-smores), white);
      font-size: 1.5rem;
      line-height: 1.33;
      letter-spacing: -0.031rem;
    }

    & .invoice-items {
      display: flex;
      flex-direction: column;
      gap: clamp(1.125rem, calc(4.789rem + -7.634vw), 3rem);
    }

    & .invoice-items-section {
      padding-block-start: clamp(
        1.688rem,
        calc(6.817rem + -10.687vw),
        4.313rem
      );

      & h4 {
        padding-block-end: clamp(0.875rem, calc(1.852rem + -2.036vw), 1.375rem);
        color: #777f98;
        font-size: 1.125rem;
        letter-spacing: -0.024rem;
        line-height: 1.77;
      }
    }
    & .invoice-form {
      flex: 1;
      padding-block-end: clamp(2.375rem, calc(8.482rem + -12.723vw), 5.5rem);
      padding-inline-start: clamp(1.5rem, calc(-0.408rem + 8.142vw), 3.5rem);
      padding-inline-end: clamp(1.188rem, calc(-0.721rem + 8.142vw), 3.188rem);

      &:has(:user-invalid) {
        & > .error-text {
          font-size: 0.625rem;

          position: relative;
          &::before {
            position: absolute;
            content: "- All fields must be added";
            display: inline-block;
            color: var(--khmer-curry);

            width: max-content;
            margin-top: 0.5rem;
          }
        }
      }
    }
    & .invoice-item {
      display: grid;
      grid-template-areas:
        "name name name name"
        "qty price total delete";
      grid-template-columns: 4rem repeat(2, 1fr) max-content;

      row-gap: 1.563rem;
      column-gap: 1rem;
      &.hide-mobile {
        display: none;
      }

      & div {
        color: light-dark(var(--true-lavender), var(--papilio-argeotus));
        font-size: 0.8125rem;
        letter-spacing: -0.00625rem;
        line-height: 1.15;
        gap: 0.5625rem;
      }
      & .name {
        grid-area: name;
      }
      & .qty {
        grid-area: qty;
      }

      & .price {
        grid-area: price;
      }

      & .total {
        grid-area: total;
        & input {
          background-color: transparent;
          border: 1px solid transparent;
          text-indent: 0;

          &::placeholder {
            color: light-dark(var(--papilio-argeotus), white);
          }

          &:read-only {
            pointer-events: none;
            outline: none;
          }
        }
      }
      & .delete {
        grid-area: delete;
        margin-block-start: auto;
        width: 0.8125rem;
        height: 3rem;
        color: var(--papilio-argeotus);
        &:hover {
          cursor: pointer;
          color: var(--khmer-curry);
        }
      }

      & input[type="number"] {
        &::-webkit-inner-spin-button,
        ::-webkit-inner-spin-button {
          -webkit-appearance: none;
          margin: 0;
        }
      }
    }

    & .add-new-item-btn {
      text-align: center;
      padding-block: 1.125rem 0.938rem;
      line-height: 1;
      font-size: 0.938rem;
      letter-spacing: -0.016rem;
      color: light-dark(var(--true-lavender), var(--papilio-argeotus));
      background-color: light-dark(#f9fafe, var(--royal-curtsy));
      border-radius: 1.5rem;
      &:hover {
        cursor: pointer;
        background-color: light-dark(var(--stotic-white), white);
        color: var(--true-lavender);
      }
    }
    & .go-back-btn {
      padding-block-end: 1.625rem;
    }
  }

  & .form-btns {
    padding-inline-start: clamp(1.5rem, calc(-0.408rem + 8.142vw), 3.5rem);
    padding-inline-end: clamp(1.188rem, calc(-0.721rem + 8.142vw), 3.188rem);
    padding-block: 1.313rem 1.375rem;

    justify-content: flex-end;
    background-color: light-dark(white, var(--river-styx));
    display: flex;
    gap: clamp(0.438rem, calc(0.378rem + 0.254vw), 0.5rem);
    font-size: 0.938rem;
    text-align: center;
    line-height: 1;
    letter-spacing: -0.016rem;
    box-shadow: 0px -10px 50px 50px hsl(from var(--animated-color) h s l / 0.1);

    position: sticky;
    bottom: 0;

    & button {
      border-radius: 1.5rem;
      padding-block: 1.125rem 0.938rem;
      /* padding-inline: clamp(1.007rem, calc(0.536rem + 2.008vw), 1.5rem)
        clamp(0.868rem, calc(0.206rem + 2.827vw), 1.563rem); */
      &:hover {
        cursor: pointer;
      }
    }

    & .discard-btn {
      color: light-dark(var(--true-lavender), var(--stotic-white));
      background-color: light-dark(#f9fafe, var(--royal-curtsy));

      width: 6rem;
      &:hover {
        background-color: light-dark(var(--stotic-white), white);
        color: var(--true-lavender);
      }
    }
    & .second-btn {
      margin-inline-start: auto;
      color: light-dark(var(--papilio-argeotus), var(--stotic-white));
      background-color: var(--carbon-blue);

      width: clamp(7.313rem, calc(6.358rem + 4.071vw), 8.313rem);

      &:hover {
        background-color: light-dark(var(--ruined-smores), var(--kon));
      }
    }

    & .save-btn {
      color: white;
      background-color: var(--venetian-nights);

      width: 8.625rem;

      &:hover {
        background-color: var(--forgotten-purple);
      }
    }
  }

  & .invoice-id {
    letter-spacing: -0.016rem;
    color: light-dark(var(--ruined-smores), white);

    & span {
      margin-inline-end: -0.25rem;
      color: light-dark(var(--true-lavender), var(--papilio-argeotus));
    }
  }
  &::backdrop {
    background-color: hsl(from black h s l / 0.5);
  }
}

.no-invoices-con {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.options-cont {
  display: flex;
  align-items: center;
}

.share-btn {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9375rem;
  line-height: 1;
  letter-spacing: -0.015625rem;
  &:hover {
    color: var(--venetian-nights);
    cursor: pointer;
  }
}
#share-dialog[open],
#response-dialog[open] {
  display: flex;
  /* border: 0; */
  /* background-color: white; */
  /* margin: auto; */
  & #share-overlay {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    width: 100%;
    margin: auto;
    background-color: light-dark(white, var(--kon));
  }

  & .share-header-cont {
    display: flex;
    align-items: center;
    justify-content: space-between;
    & button {
      width: max-content;
      height: max-content;
      background-color: transparent;
      &.close-btn:hover > svg {
        color: var(--venetian-nights);
      }
    }
  }

  & .share-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: light-dark(var(--carbon-blue), var(--ruined-smores));
    padding-inline: clamp(1.5rem, calc(1.023rem + 2.036vw), 2rem);
    padding-block: clamp(1.625rem, calc(1.565rem + 0.254vw), 1.688rem)
      clamp(1.313rem, calc(1.435rem + -0.254vw), 1.375em);
    border-radius: 0.45rem;
    & a {
      text-decoration: none;
      color: white;
      pointer-events: none;
      line-height: 1;
      font-size: 0.938rem;
      letter-spacing: -0.016rem;
      word-break: break-word;
    }
    & button {
      background-color: transparent;
      padding-block: 0;
      padding-inline: 0;
      width: max-content;
      /* border-radius: n; */
      &:hover {
        cursor: pointer;
        & svg {
          color: var(--venetian-nights);
        }
      }
    }
  }
  & .share-dialog-cont {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    & h2 {
      color: light-dark(var(--ruined-smores), white);
    }

    & .join-room-btn {
      background-color: var(--venetian-nights);
      width: clamp(8.188rem, calc(10.386rem + -4.58vw), 9.313rem);
      color: white;
      text-align: center;
      border-radius: 1.5rem;
      padding-block: 0.5rem;
      align-self: center;
      text-decoration: none;

      &:hover {
        background-color: var(--forgotten-purple);
        cursor: pointer;
      }
    }
  }
}
#response-popover:popover-open {
  border: 0;
  background-color: light-dark(white, var(--kon));
  color: light-dark(var(--true-lavender), var(--stotic-white));
  border-radius: 0.5rem;
  /* margin-block-end: auto; */
  margin-inline-start: auto;
  top: 2rem;
  right: 1rem;
  /* left: 0; */
}
#response-dialog[open] {
  height: 10rem;
  & #share-overlay {
    visibility: visible;
    flex-direction: column;
    gap: 1rem;

    & p {
      /* flex: 1; */
      margin-block-end: 0;
    }
    & div {
      /* flex: 1; */
    }
  }
}
.status-token {
  display: flex;
  align-items: baseline;
  justify-content: center;
  border-radius: 0.375rem;
  gap: 0.5rem;
  padding-block: 0.875rem 0.688rem;
  width: 6.5rem;
  text-transform: capitalize;
  margin-inline-start: auto;
  & .status {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
  }

  &[data-status="paid"] {
    background-color: hsl(from var(--paid) h s l / 0.0571);
    color: var(--paid);

    & .status {
      background-color: var(--paid);
    }
  }
  &[data-status="pending"] {
    background-color: hsl(from var(--pending) h s l / 0.0571);
    color: var(--pending);

    & .status {
      background-color: var(--pending);
    }
  }
  &[data-status="draft"] {
    color: var(--draft);
    background-color: light-dark(
      hsl(from var(--carbon-blue) h s l / 0.0571),
      hsl(from var(--stotic-white) h s l / 0.0571)
    );

    & .status {
      background-color: var(--draft);
    }
  }
}
main {
  /* show scrollbars in main */
  /* scrollbar-color: light-dark(var(--stotic-white), var(--royal-curtsy))
      transparent; */
  /* height: 100vh; */
  /* overflow: auto; */
  /* comment out flex: 1 */
  /* dynamic block padding end less as screen gets bigget */
  flex: 1;
  padding-inline: clamp(1.5rem, calc(0.069rem + 6.107vw), 3rem);
  padding-block: clamp(2rem, calc(0.271rem + 7.379vw), 3.813rem)
    clamp(6.563rem, calc(2.507rem + 17.303vw), 10.813rem);
  /* padding-block-end: 12rem; */
}
@media (min-width: 48rem) {
  .bill-from-section {
    grid-template-areas:
      "header . ."
      "addy addy addy"
      "city post-code country";
  }

  .bill-to-section {
    grid-template-areas:
      "header . ."
      "name name name"
      "email email email"
      "addy addy addy"
      "city post-code country";
  }

  div.edit-btns {
    & > button {
      display: block;

      &.edit-btn {
        margin-inline-start: auto;
      }

      &.delete-btn {
        margin-inline-start: 0;
      }
    }
    & .status-cont {
      gap: 1.25rem;

      & .status-token {
        margin-inline-start: 0;
      }
    }
  }
  footer.edit-btns {
    display: none;
  }

  .edit-btns .header {
    & .logo-cont {
      padding-inline: clamp(1.5rem, calc(0.929rem + 1.19vw), 2rem);
      padding-block: clamp(1.563rem, calc(1.063rem + 1.042vw), 2rem);
      width: clamp(5rem, calc(3.357rem + 3.423vw), 6.438rem);
    }

    & .profile-pic-cont {
      & img {
        width: clamp(2rem, calc(1.429rem + 1.19vw), 2.5rem);
      }
    }

    & .theme-toggle {
      padding-inline: 2rem;
    }
  }
  .hide-mobile {
    display: inline;
  }

  .individual-invoice {
    padding-inline: clamp(2rem, calc(0.857rem + 2.381vw), 3rem);
    padding-block: clamp(2rem, calc(0.857rem + 2.381vw), 3rem);
    & .invoice-info {
      display: grid;

      row-gap: 1.3125rem;
      grid-template-columns: repeat(4, 1fr);
      grid-template-areas:
        "title title . addy"
        "date bill-to email email"
        "due bill-to . .";

      & .user-addy {
        text-align: right;
      }
    }

    & .invoice-items {
      & .invoice-item {
        grid-template-areas: "name name qty price total";
        grid-template-columns: repeat(2, 1fr) max-content repeat(2, 1fr);

        & .price {
          justify-self: end;
          color: light-dark(var(--true-lavender), var(--stotic-white));
        }
        & .total {
          justify-self: end;
        }

        & .qty {
          color: light-dark(var(--true-lavender), var(--stotic-white));
          & > span {
            display: none;
          }
        }
      }
      & .invoice-header {
        display: grid;
      }
    }
  }
  .invoices {
    &:has(> *:not(.hide)) {
      padding-block-start: clamp(3.438rem, calc(2.795rem + 1.339vw), 4rem);
    }
    & .invoice {
      grid-template-columns: max-content repeat(4, 1fr);

      grid-template-areas: "id due user amount status";
      & .amount {
        text-align: end;
      }
      & .status-token {
        text-align: center;
      }

      & .invoice-id {
        margin-block-end: 0rem;
      }
      & .invoice-user {
        text-align: left;
        margin-block-end: 0rem;
      }
      & .due-date {
        text-align: center;
      }
    }
  }
  .invoice-date-section {
    display: grid;
    grid-template-areas:
      "date net"
      "desc desc";
    grid-template-columns: repeat(2, 1fr);
  }
  main {
    padding-inline: clamp(3rem, calc(-11.643rem + 30.506vw), 15.813rem)
      clamp(3rem, calc(-18.929rem + 45.685vw), 22.188rem);
    padding-block: clamp(3.813rem, calc(2.67rem + 2.381vw), 4.813rem)
      clamp(10.813rem, calc(4.027rem + 14.137vw), 16.75rem);
  }
  #new-invoice-dialog[open],
  #edit-invoice-dialog[open] {
    & .form-cont {
      border-top-right-radius: 1.25rem;
      border-bottom-right-radius: 1.25rem;
      width: 80%;

      & .go-back-btn {
        display: none;
      }

      & .invoice-items-section {
        padding-block-start: clamp(1.688rem, calc(1.21rem + 2.036vw), 2.188rem);
      }

      & .item-header {
        padding-block-end: 0.938rem;

        & .delete {
          height: 0;
        }
      }
      & .invoice-item {
        display: grid;
        grid-template-areas: "name name qty price total delete";
        grid-template-columns: repeat(2, 1fr) 2.875rem repeat(2, 1fr) max-content;

        &.hide-mobile {
          display: grid;
        }

        & .label-name {
          position: absolute;
          width: 1px;
          height: 1px;
          padding: 0;
          margin: -1px;
          overflow: hidden;
          clip: rect(0, 0, 0, 0);
          white-space: nowrap; /* Prevent text wrapping */
          border: 0;
        }

        & .qty {
          & input[type="number"] {
            text-indent: 0;
            text-align: center;
          }
        }
      }
    }

    & .form-btns {
      border-top-right-radius: 1.25rem;
      border-bottom-right-radius: 1.25rem;
    }
  }
}

@media (min-width: 90rem) {
  body {
    flex-direction: row;
  }
  .header {
    height: 100%;
    flex-direction: column;
    border-top-right-radius: 1.25rem;
    border-bottom-right-radius: 1.25rem;
    & .profile-pic-cont {
      border-top: 1px solid var(--independence);
      border-left: 0;
    }
    & .logo-cont {
      margin-block-end: auto;
    }

    & .theme-toggle {
      padding-block: 2rem;
    }
  }

  #new-invoice-dialog[open],
  #edit-invoice-dialog[open] {
    flex-direction: row;
    min-width: 90rem;

    margin: 0 auto;

    & .form-cont {
      flex: 0;
      min-width: 38.5rem;
    }
  }
}
