#main:has(.attachment-container) {
  padding: 0 0;
  
}


.form-section,
.form-ctrls {
  border-top: 1px solid var(--border);
  margin: 1em 0;
  padding: 3em 0 1em 0;
}

.form-ctrls-overlay {
  margin: 0;
  padding: 1em 0;
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;

  & h1 {
    margin-top: 0.2em;
  }
}

.form-header__buttons {
  display: flex;
  gap: 8px;
  
}

.form-header__titled {
  gap: 8px;
  
  & .title-box {
    flex-grow: 1;
  }
  & [data-icon] {
    display: flex;
    gap: 6px;
    align-items: flex-start;

    &::before {
      color: var(--data-icon-color, #717274);
      font-family: var(--font-icons);
      font-variation-settings: 'opsz' 24, 'wght' 300, 'FILL' 1, 'GRAD' 0;
      font-size: 2rem;
      line-height: 1;
      margin-top: 6px;
      content: attr(data-icon);
    }
  }  
}

.form-header__attachment {

  & .title-box {
    display: block;
    margin: 1em 4px 1em -8px;
  }

}




.field {
  max-width: 990px;
  display: flex;
  align-items: start;
  padding-bottom: 1.5rem;
  &>div:nth-child(1) {
    padding-top: 12px;
    flex-basis: 33%;
    & label {
      font-size: 0.875rem;
      line-height: 1.2;
      color: #555;
    }
  }

  & .button-container {
    margin-top: 8px;
    margin-left: -8px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  &>div:nth-child(2) {
    flex-grow: 0;
    flex-basis: 66%;
  }

  

  & .field_with_errors {
    --border: var(--error);
  }

  
}

.i18n__input label,
.i18n__label {
  &::after {
    content: 'flag';
    font-family: var(--font-icons);
    color: #EC5F59;
    margin-left: 0.2em;
    font-variation-settings: 'opsz' 24, 'wght' 300, 'FILL' 1, 'GRAD' 0;
  }
}

.attachment label {
  font-size: 0.875rem;
  line-height: 1.2;
  color: #555;
}

.material__input {
  display: flex;
  font-family: var(--font-base);
  border: 1px solid var(--border);
  font-size: 1rem;
  letter-spacing: 0.00625em;
  border: none !important;
  background-color: transparent;
  width: 100%;
  height: 100%;
  appearance: none;
  padding: 0;
  box-shadow: none;

  &:focus {
    outline: none;
    }
}

 textarea.material__input {
  resize: none;
 }

.material__input-select {
  appearance: none;
  position: relative;
  padding-right: 24px;
  padding-left: 4px;
  background-image: url(data:image/svg+xml,%3Csvg%20width%3D%2210px%22%20height%3D%225px%22%20viewBox%3D%227%2010%2010%205%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%0A%20%20%20%20%3Cpolygon%20id%3D%22Shape%22%20stroke%3D%22none%22%20fill%3D%22%230%22%20fill-rule%3D%22evenodd%22%20opacity%3D%220.54%22%20points%3D%227%2010%2012%2015%2017%2010%22%3E%3C%2Fpolygon%3E%0A%3C%2Fsvg%3E);
  background-repeat: no-repeat;
  background-position: 100% 50%;

}

.date-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 2fr;
  gap: 20px;
  

  & .field {
    display: block;
    padding: 0;
    
    &>div:nth-child(1), &>div:nth-child(2) {
      padding-top: 0;
      flex-basis: 1;
      flex-grow: 1;
      width: 100%;
    }

    &>div:nth-child(1) {
      margin-bottom: 2px;
    }
  }

  &[data-n='0'] {
    &>div:nth-child(2), &>div:nth-child(3) {
      & label {
        color: var(--clr-grey-200);
      }
    }
  }
  &[data-n='1'] {
    &>div:nth-child(3) {
      & label {
        color: var(--clr-grey-200);
      }
    }
  }
}


.title-box {
  
  & div {
    display: flex;
    width: 100%;
    flex-direction: column;
  }

  
  & input[type="text"] {
    display: flex;
    flex: 4;
    
    font-family: var(--font-base);
    border: 1px solid var(--border);
    font-size: 1.5rem;
    line-height: 2;
    font-weight: 400;
    letter-spacing: 0.00625em;
    border: none !important;
    background-color: transparent;
    
    height: 100%;
    appearance: none;
    padding: 8px;
    border-radius: 4px;
    box-shadow: none;

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

.input-box {
  display: flex;
  height: 46px;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  padding: 0 16px;
  margin: 0;
  overflow: visible;
  -webkit-box-align: baseline;
  --outline: var(--action);
  border-radius: 4px;
  border: 1px solid var(--border);

  & .field_with_errors {
    display: flex;
    height: 100%;
    width: 100%;
  }

  &:has(textarea) {
    padding: 0 0 0 8px;
    height: auto;

    & textarea {
      line-height: 1.2;
      margin: 1px 0;
      padding: 8px 16px 8px 0;      
    } 
  }

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

  &:focus-within {
    outline: 2px solid var(--outline);
    outline-offset: -2px;
  }

  &:has(.field_with_errors) {
    --outline: var(--error);

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

.input-box-url {
  
  & .base__url {
    flex-shrink: 0;
  }

  & span {
    font-size: 1rem;
    letter-spacing: 0.00625em;
    color: var(--clr-grey-400);
    
  }
}

.i18n__input,
.title-box .i18n__input {
  display: none;
}



form[data-locale='en'] .i18n__input-en,
form[data-locale='zh'] .i18n__input-zh,
form[data-locale='hr'] .i18n__input-hr,
form[data-locale='cs'] .i18n__input-cs,
form[data-locale='da'] .i18n__input-da,
form[data-locale='nl'] .i18n__input-nl,
form[data-locale='fi'] .i18n__input-fi,
form[data-locale='fr'] .i18n__input-fr,
form[data-locale='fr_ca'] .i18n__input-fr_ca,
form[data-locale='de'] .i18n__input-de,
form[data-locale='hu'] .i18n__input-hu,
form[data-locale='it'] .i18n__input-it,
form[data-locale='ja'] .i18n__input-ja,
form[data-locale='ko'] .i18n__input-ko,
form[data-locale='nb'] .i18n__input-nb,
form[data-locale='pl'] .i18n__input-pl,
form[data-locale='pt'] .i18n__input-pt,
form[data-locale='ro'] .i18n__input-ro,
form[data-locale='sr'] .i18n__input-sr,
form[data-locale='sk'] .i18n__input-sk,
form[data-locale='sl'] .i18n__input-sl,
form[data-locale='es'] .i18n__input-es,
form[data-locale='sv'] .i18n__input-sv,
form[data-locale='uk'] .i18n__input-uk{
  display: flex;
}


.icon-cb,
.icon-rb {
  display: block;
  position: relative;
  cursor: pointer;
  user-select: none;

  & svg rect {
    fill: #ccc !important;
  }

  & input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;

    &:checked~.cm {
      color: #ccc;
    }

    &:checked~svg rect {
      fill: #585857 !important;
    }
  }

  &:focus-within {
    .cm {
      outline: 2px solid var(--action);
      outline-offset: -4px;
    }
  }

  & .cm {
    color: #ccc;
    display: block;
    height: 28px;
    width: 28px;
    font: 28px/1 var(--font-icons);
    font-variation-settings: 'opsz' 24, 'wght' 300, 'FILL' 1, 'GRAD' 0;
  }

  &.toogle {
    & .cm>*:nth-child(2) {
      display: none;
    }

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

    & input {
      &:checked~.cm {
        color: var(--action);

        &>*:nth-child(1) {
          display: none;
        }

        &>*:nth-child(2) {
          display: inline;
        }
      }
      &:disabled~.cm {
        color: var(--clr-grey-500);
      }
    }
  }
}

p[role="alert"] {
  margin: 4px 0 0 0;
  color: var(--error);
  font-size: 0.75rem;
}

.icon-rb {
  & input {
    &:checked~.cm {
      color: #000;
      background: #ccc;
      border-radius: 50%;
    }
  }

  & .cm {
    color: #ccc;
    display: block;
    text-align: center;
    text-transform: uppercase;
    height: 24px;
    width: 24px;
    font: 400 0.625rem/24px "Roboto Mono", monospace;
  }
}

.form-ctrls input[type="submit"],
.form-ctrls button {
  font-size: 0.9375rem;
  letter-spacing: 0.00625em;
  padding: 0.6em 1.4em;
  background: var(--action);
  border-radius: 4px;
  color: var(--icon-active);
  text-decoration: none;
  font-family: var(--base);
  border: none;
  cursor: pointer;
  box-sizing: border-box;
}

.btn {
  display: inline-flex;
  font-size: 0.875rem;
  letter-spacing: 0.00625em;
  padding: 0 8px 0 8px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--action);
  position: relative;
  align-items: center;
  line-height: 32px;
  
  &:hover {
    background-color: var(--clr-grey-100);
  }  
}



.add-btn, .icon-only-btn, .action-btn {
  font-size: 1rem;
  letter-spacing: 0.00625em;
  padding: 0 14px 0 32px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--black);
  position: relative;
  align-items: center;
  line-height: 48px;
  box-shadow: 0px 0px 1.5px rgba(0, 0, 0, 0.105), 0px 1px 3px rgba(0, 0, 0, 0.21);
  background-color: transparent;
  border: none;
  &:hover {
    background-color: var(--clr-grey-200);
  }  
}

.icon-btn {
  display: inline-flex;
  font-size: 0.875rem;
  letter-spacing: 0.00625em;
  padding: 0 8px 0 24px;
  color: var(--black);
  position: relative;
  align-items: center;
  line-height: 32px;  
  background-color: transparent;
  border: none;
  & span::before {
    position: absolute;
    content: attr(data-icon);
    left: 2px;
    font-family: var(--font-icons);
    font-variation-settings: 'opsz' 24, 'wght' 300, 'FILL' 1, 'GRAD' 0;
    font-size: 1.25rem;
    line-height: 32px;
  }
}

.icon-only-btn {
  display: inline-flex;
  font-size: 0.875rem;
  letter-spacing: 0.00625em;
  padding: 0 8px;
  color: var(--black);
  position: relative;
  align-items: center;
  font-family: var(--font-icons);
  font-variation-settings: 'opsz' 24, 'wght' 300, 'FILL' 1, 'GRAD' 0;
  font-size: 2rem;
  line-height: 32px;

  &:disabled {
    color: var(--clr-grey-400);
    cursor: not-allowed;
    &:hover {
      background-color: transparent;
    }  
  }
}

.add-btn {
  & span::before {
    position: absolute;
    content: 'add';
    left: 2px;
    font-family: var(--font-icons);
    font-variation-settings: 'opsz' 24, 'wght' 300, 'FILL' 1, 'GRAD' 0;
    font-size: 2rem;
    line-height: 48px;
  }
}

.action-btn {
  & span::before {
    position: absolute;
    content: attr(data-icon);
    left: 2px;
    font-family: var(--font-icons);
    font-variation-settings: 'opsz' 24, 'wght' 300, 'FILL' 1, 'GRAD' 0;
    font-size: 1.75rem;
    line-height: 48px;
  }
}

.form-ctrls {
  display: flex;
  justify-content: end;
  align-items: center;
  gap: 20px;
}

.form-nav-links {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.625rem;

  
}

.i18n__from-ctrls {
  display: flex;
  justify-content: space-between;
  
  margin-top: 8px;;

  gap: 4px;

  & label {
    font-size: 0.9375rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.00625em;    
  }
  & span {
    border-radius: 50%;
    display: inline-block;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    user-select: none;

    &:has(em:nth-child(2)) {
      position: relative;

      & em:nth-child(2) {
        position: absolute;
        right: -12px;
        top: -12px;
        font-size: 0.625rem;
        width: 24px;
        height: 24px;
        line-height: 24px;
        text-align: center;
        border-radius: 50%;
        font-family: var(--font-mono);
      }
    }
  }

  & em {
    font-style: normal;
  }

  & input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;

    &:checked + span {
      background-color: var(--clr-grey-600);
      color: var(--white);

      & em:nth-child(2) {
        z-index: -1;
        background-color: var(--clr-grey-500);
  
      }
    }
  }
}

.form-ctrls a,
.delete-link {
  color: var(--secondary);
  text-decoration: none;
  font-size: 0.9375rem;
  letter-spacing: 0.00625em;
  appearance: none;
  background: none;
  border: none;
}

.dropzone {
  width: 80px;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1em;
  box-sizing: border-box;
  cursor: pointer;

  border: 2px dotted var(--clr-grey-200);
  border-radius: 8px;

  & input[type=file] {
    display: none;
  }

  &:hover {
    box-shadow: 0px 0px 1.5px rgba(0, 0, 0, 0.105), 0px 1px 3px rgba(0, 0, 0, 0.21);
    border-color: var(--clr-grey-200);
    background-color: var(--clr-grey-200);

    & span {
      color: var(--clr-black);
    }
  }


  & span {
    color: var(--clr-grey-500);
    font-family: var(--font-icons);
    font-variation-settings: 'opsz' 24, 'wght' 300, 'FILL' 1, 'GRAD' 0;
    
    font-size: 2.625rem;
  }
}

.dropzone--small {
  margin-top: 0;
  width: 48px;
  height: 48px;

  & span {
    font-size: 2rem;
  }
}

.drag-over {
  border-color: var(--clr-grey-400);
  border-style: solid;
  background-color: var(--clr-grey-200);

  & span {
    color: var(--clr-black);
  }
}

#attachments {
  gap: 0;
}



.file-details {
  text-align: center;
  font: 0.75rem var(--font-mono);  
  
}

.file-name {
  hyphens: auto;
  word-break: break-word;
  word-wrap: break-word;
  overflow-wrap: break-word;
  margin-bottom: 2px;
}

.file-data {
  color: var(--action);
}

.file-data-large {
  font: 0.875rem var(--font-mono);  
}

.asset-ctrls {
  display: none;
  gap: 4px;
  justify-content: center;
  font: 1.5rem var(--font-icons);
  font-variation-settings: 'opsz' 24, 'wght' 300, 'FILL' 1, 'GRAD' 0;

  & > div {
    display: flex;
    gap: 4px;
  }
  
  & a, & .handle {
    display: inline-flex;
    width: 28px;
    height: 28px;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    text-decoration: none;
    color: var(--clr-grey-400);

    &:hover {
      background-color: var(--clr-grey-200);
      color: var(--clr-grey-600);
    }
  }
}


.asset-thumbnail {
  position: relative;
  width: 100%;

  & img {
    position: absolute;
    max-width: 100%;
    max-height: 100%;
    box-shadow: rgba(0, 0, 0, 0.14) 0px 2px 2px 0px, rgba(0, 0, 0, 0.12) 0px 3px 1px -2px, rgba(0, 0, 0, 0.2) 0px 1px 5px 0px;
  }

  &::after {
    content: "";
    display: block;
    padding-bottom: 100%;
  }
}

.image-container {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#node-tags {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;

  font-size: 1rem;

  & label {
    font-size: 0.875rem;
    color: #555;
  }
  
}

#overlay {
  position: fixed;
  inset: 0 0 0 0;
  background-color: rgba(32,33,36,0.6);
  z-index: 1100;

}


.inner-window-container {
  position: fixed;
  inset: 50px 0 0 0;  
  overflow: hidden;
  background-color: var(--bg);
  border-radius: 20px 20px 0 0;
}

#inner-window {
  position: absolute;
  inset: 60px 40px 0 40px;
  display: flex;
  flex-direction: column;
  
  & .list-container {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;    
  }

  & .list {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 0;    

  }

  & .assets__container {
    flex: 1 1 0;
    overflow-y: scroll;        
  }  
}


.close-overlay {  
  position: absolute;
  top: 20px;
  right: 20px;
  font: 2rem/36px var(--font-icons);
  font-variation-settings: 'opsz' 24, 'wght' 300, 'FILL' 1, 'GRAD' 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--clr-black);
  border: none;
  background-color: transparent;

  &:hover {
    color: var(--black);
    background-color: var(--clr-grey-200);
  }
}

.tag-context {
  & .tag-container {
    margin-top: 2px;
  }
}

.tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  font: 0.875rem/1.4 var(--font-mono);
  background: var(--clr-grey-300);
  padding: 2px 6px 3px 6px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--black);
}

.parent__tag {
  background: var(--clr-grey-500);
  color: var(--clr-grey-100);
}

.trix-button-group--file-tools {
  display: none !important;
}

trix-toolbar, trix-editor {
  font-size: 1rem;
}

trix-editor {

  & h1 {
    font-weight: 600;
    font-size: 1.5rem;
    line-height: 1.25;
    margin: 0 0 0.4em 0;
  }

  & h2 {
    font-weight: 600;
    font-size: 1.125rem;
    line-height: 1.25;
    margin: 0 0 0.4em 0;
  }

  & ul, ol {
    display: block;    
    margin-block-start: 1em;
    margin-block-end: 1em;
    padding-inline-start: 1.2em;
  }
  & ul {
    list-style-type: disc;
  }
  & ol {
    list-style-type: decimal;
  }

  & a {
    color: blue;
  }

  & pre {
    background-color: #eee;
    padding: 0.5em;
  }

  & blockquote {
    margin: 1em 0;
    padding: 0.5em;
    background-color: #eee;
    &::before {
      content: '"';      
      color: #999;
    }
    &::after {
      content: '"';
      color: #999;
    }
  }
  

}

.trix-button--icon-heading-1::before {
  background-image: url("ico-h1.svg") !important;
}

.trix-button--icon-heading-2::before {
  background-image: url("ico-h2.svg");
}

.trix-button--icon-heading-3::before {
  background-image: url("ico-h3.svg");
}


.attachment-container {
  padding-left: calc((100vw - 80px) / 2);
  margin: 30px 40px;
}

.image-viewer {
  position: fixed;
  left: 80px;
  top: 0;
  bottom: 0;
  width: calc((100vw - 80px) / 2);  
  border-right: 1px solid var(--border);
}




#scan-result {  
  font-size: 1rem;  
  border-radius: 4px;
  
  &:has(div) {
    background-color: var(--clr-grey-100);
    margin-top: 1em;  
    padding: 1em;  
  }
  

  & > div {    
    tab-size: 4;
    text-align: left;
    white-space: pre;
    width: auto;
    word-break: normal;
    word-spacing: 0px;
  }


}


.date-formatted {
  font-size: 1rem;
  margin-top: 12px;
}



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

.node__status {
  font-size: 1rem;
  letter-spacing: 0.00625em;
  line-height: 1.2;

  & li+li {
    margin-top: 0.4em;
  }

  li {
    display: flex;
    gap: 0.4em;
  }
}

.datetime__select {  
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.6em;
  font-size: 1rem;
  letter-spacing: 0.00625em;

  select {
    height: 2rem;
    &:focus {
      &:focus {      
        outline: 2px solid var(--action);    
      }
  
    }
  }

  & button {
    color: var(--data-icon-color, #717274);
    font-family: var(--font-icons);
    font-variation-settings: 'opsz' 24, 'wght' 300, 'FILL' 1, 'GRAD' 0;
    font-size: 1.75rem;
    line-height: 1.142857142857143;
    appearance: none;
    background: none;
    border: none;
    padding: 0;
  }

  & select {
    width: auto;
    padding-right: 20px; 
  }

  &.with-toggles {
    & button:nth-of-type(1) {
      display: none;
    }
    & button:nth-of-type(2) {
      display: inline;
    }

    &:has(select:disabled) {

      & span, select {
        display: none;
      }

      & button:nth-of-type(1) {
        display: inline;
      }
      & button:nth-of-type(2) {
        display: none;
      }
  }
    
  }
}

.ts-wrapper {
  flex-grow: 1;
  align-self: center;
}

.focus .ts-control, 
.ts-control {
  border: none;
  padding: 8px 0;
  box-shadow: none;
}

.ts-dropdown, .ts-control, .ts-control input {
  font-size: 1rem;
}

.ts-dropdown .active {
  background-color: var(--clr-grey-300);
  color: var(--black);
}

.ts-wrapper.multi .ts-control > div {
  background-color: var(--clr-grey-300);
}

.destroy__field-btn {
  appearance: none;
  position: absolute;
  top: 4px;
  right: 4px;
  border: none;
  border-radius: 50%;
  display: flex;
  width: 32px;
  height: 32px;
  justify-content: center;
  align-items: center;
  font-family: var(--font-icons);
  background-color: transparent;
  font-size: 1.375rem;
  color: var(--clr-grey-400);

  &:hover {
    background-color: var(--clr-grey-200);
    color: var(--clr-grey-700);
  }
}

.lexxy__field {
  width: 100%;
  max-width: 100%;
}

:where(.lexxy-content) {
  code, pre {
    &:is(pre),
    &[data-language] {
      text-wrap: wrap;       /* Overrides 'nowrap' */
      white-space: pre-wrap; /* Overrides 'pre' while keeping formatting */
      word-break: break-all; /* Ensures long strings don't push the width */
    }
  }

  h2, h3, h4, h5 {
    font-weight: 400;
    strong {
      font-weight: 700;
    }
  }
}