@layer lotek {
  .lt-file-upload {
    box-sizing: border-box;
    display: block;
    inline-size: 100%;
    padding: var(--lt-file-upload-padding, var(--lt-spacing-2));
    font-family: inherit;
    font-size: var(--lt-font-size-m);
    line-height: var(--lt-line-height-default);
    color: var(--lt-color-neutral-text-strong);
    background: var(--lt-color-neutral-canvas);
    border: 1px dashed var(--lt-color-neutral-border);
    border-radius: var(--lt-file-upload-radius, var(--lt-spacing-1));
    cursor: pointer;
  }

  /* The button inside the field is the browser's own, and can only be styled
     through this pseudo-element. Its text comes from the browser and the
     operating system's language, so it cannot be translated from here. */
  .lt-file-upload::file-selector-button {
    margin-inline-end: var(--lt-spacing-3);
    padding: var(--lt-spacing-2) var(--lt-spacing-4);
    font-family: inherit;
    font-size: var(--lt-font-size-m);
    line-height: var(--lt-line-height-default);
    color: var(--lt-color-accent-text);
    background: transparent;
    border: 1px solid var(--lt-color-accent-border);
    border-radius: var(--lt-file-upload-radius, var(--lt-spacing-1));
    cursor: pointer;
  }

  .lt-file-upload::file-selector-button:hover {
    background: var(--lt-color-accent-surface);
  }

  .lt-file-upload:hover {
    border-color: var(--lt-color-neutral-border-strong);
  }

  .lt-file-upload:focus-visible {
    outline: var(--lt-focus-ring);
    outline-offset: 2px;
  }

  .lt-file-upload:disabled {
    background: var(--lt-color-disabled-surface);
    color: var(--lt-color-disabled-text);
    border-color: var(--lt-color-disabled-surface);
    cursor: not-allowed;
  }

  .lt-file-upload[data-state="invalid"] {
    border-color: var(--lt-color-danger-text);
    background: var(--lt-color-danger-surface);
  }

  .lt-file-upload[data-state="success"] {
    border-color: var(--lt-color-success-text);
  }

  /* Disabled wins over a state. `[data-state]` used to come after
     `:disabled` with the same specificity, and an invalid field in a form
     that was disabled during submission looked red, not disabled. */
  .lt-file-upload:disabled[data-state] {
    background: var(--lt-color-disabled-surface);
    color: var(--lt-color-disabled-text);
    border-color: var(--lt-color-disabled-surface);
  }

  /* The list of the selected files. You write it yourself, since only you
     know what should happen when a file is removed. */
  .lt-file-upload-list {
    display: flex;
    flex-direction: column;
    gap: var(--lt-spacing-2);
    margin: var(--lt-spacing-2) 0 0;
    padding: 0;
    list-style: none;
  }

  .lt-file-upload-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--lt-spacing-2);
    padding: var(--lt-spacing-2) var(--lt-spacing-3);
    background: var(--lt-color-neutral-surface);
    border-radius: var(--lt-file-upload-radius, var(--lt-spacing-1));
    /* File names rarely have spaces to break at, and the button text repeats
       the name. Without this the row pushes wider than the screen on
       mobile. */
    overflow-wrap: anywhere;
  }

  /* A flex item cannot by default become narrower than its content. Without
     this the file name does not break, whatever we say above. */
  .lt-file-upload-list li > * {
    min-inline-size: 0;
  }
}
