.o-spreadsheet {
  .border {
    border: 1px solid var(--os-border-color) !important;
  }

  .border-bottom {
    border-bottom: 1px solid var(--os-border-color) !important;
  }

  .border-top {
    border-top: 1px solid var(--os-border-color) !important;
  }

  .border-start {
    border-left: 1px solid var(--os-border-color) !important;
  }

  .border-end {
    border-right: 1px solid var(--os-border-color) !important;
  }
  touch-action: pan-y;
  color: var(--os-text-body);

  .bg-white {
    background-color: var(--os-white-bg) !important;
  }

  .bg-white-contrasted {
    background-color: light-dark(var(--os-white), var(--os-gray-300));
  }

  select > option {
    background-color: var(--os-white-bg);
  }

  input {
    background-color: transparent;
  }

  &.o-spreadsheet-mobile .o-spreadsheet-topbar-wrapper,
  .o-spreadsheet-bottombar-wrapper {
    box-shadow: 0 0 3px 1px var(--os-gray-400);
  }
  .o-spreadsheet-bottombar-wrapper {
    overscroll-behavior: none;
  }
  position: relative;
  display: grid;
  font-size: 14px;

  .text-muted {
    color: var(--os-text-body-muted) !important;
  }
  .o-disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
  }

  &,
  *,
  *:before,
  *:after {
    /* rtl not supported ATM */
    direction: ltr;
  }
  .o-separator {
    margin-top: var(--os-menu-separator-padding);
    margin-bottom: var(--os-menu-separator-padding);
  }
  .o-hoverable-button {
    border-radius: 4px;
    cursor: pointer;
    .o-icon {
      color: var(--os-text-body);
    }
    &:not(.o-disabled):not(.active):hover {
      background-color: var(--os-button-hover-bg);
      color: var(--os-button-hover-text-color);
      .o-icon {
        color: var(--os-button-hover-text-color);
      }
    }
    &.active {
      background-color: var(--os-button-active-bg);
      color: var(--os-button-active-text-color);
      .o-icon {
        color: var(--os-button-active-text-color);
      }
    }
  }

  .o-grid-container {
    display: grid;

    .o-top-left {
      border: 1px solid var(--os-grid-border-color);
      margin-bottom: -1px;
      margin-right: -1px;
    }

    .o-column-groups {
      grid-column-start: 2;
      border-top: 1px solid var(--os-grid-border-color);
    }

    .o-row-groups {
      grid-row-start: 2;
    }

    .o-group-grid {
      border-top: 1px solid var(--os-grid-border-color);
      border-left: 1px solid var(--os-grid-border-color);
    }
  }

  .o-input {
    min-width: 0px;
    padding: 1px 0;
    width: 100%;
    outline: none;
    border-color: var(--os-border-color);
    border-style: solid;
    color: var(--os-gray-900);

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

  select.o-input,
  .o-select {
    cursor: pointer;
    border-style: solid;
    border-width: 0 0 1px 0;
    padding: 1px 0px 1px 0px;

    display: flex;
    align-items: center;

    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    &:after {
      content: "";
      background-color: currentColor;
      mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='7' height='4' viewBox='0 0 7 4'><polygon fill='currentColor' points='3.5 4 7 0 0 0'/></svg>")
        no-repeat right;
      width: 7px;
      height: 4px;
      margin-left: auto;
      margin-right: 1px;
      padding-left: 10px;
    }
    background: transparent;
    text-overflow: ellipsis;

    &:disabled {
      color: var(--os-disabled-text-color);
      opacity: 0.4;
      cursor: default;
    }
  }

  .o-input[type="text"] {
    border-width: 0 0 1px 0;
  }

  .o-input[type="number"],
  .o-input[type="date"],
  .o-number-input {
    border-width: 0 0 1px 0;
    /* Remove number input arrows */
    appearance: textfield;
    &::-webkit-outer-spin-button,
    &::-webkit-inner-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }
  }

  .o-two-columns {
    grid-column: 1 / 3;
  }

  .o-text-icon {
    vertical-align: middle;
  }

  .o-grid {
    position: relative;
    overflow: hidden;
    background-color: light-dark(var(--os-background-gray-color), #1e1f29);
    &:focus {
      outline: none;
    }

    > .os-canvas-background {
      width: fit-content;
      > canvas {
        display: block;
        box-sizing: content-box;
        border-bottom: 1px solid var(--os-canvas-border-color);
        border-right: 1px solid var(--os-canvas-border-color);
      }
    }
  }

  .o-grid-overlay {
    position: absolute;
    outline: none;
    z-index: var(--os-components-importance-grid-overlay);
  }

  .o-button {
    border-radius: 4px;
    font-weight: 500;
    font-size: 14px;
    min-height: 32px;
    line-height: 16px;
    flex-grow: 1;
    background-color: var(--os-button-bg);
    border: 1px solid var(--os-button-bg);
    color: var(--os-text-body);

    &:disabled {
      color: var(--os-disabled-text-color);
    }

    &.primary {
      background-color: var(--os-primary-button-bg);
      border-color: var(--os-primary-button-bg);
      color: var(--os-primary-button-text-color);
      &:hover:enabled {
        color: var(--os-primary-button-text-color);
        background-color: var(--os-primary-button-hover-bg);
      }
      &:active:enabled {
        background-color: var(--os-primary-button-active-bg);
        color: var(--os-primary-button-bg);
      }
      &.o-disabled,
      &:disabled {
        opacity: 0.5;
      }
    }

    &:hover:enabled {
      color: var(--os-button-hover-text-color);
      background-color: var(--os-button-hover-bg);
    }
    &:active:enabled {
      color: var(--os-button-active-text-color);
      background-color: var(--os-button-active-bg);
    }

    &.o-disabled,
    &:disabled {
      opacity: 0.8;
    }

    &.o-button-danger:hover {
      color: var(--os-white);
      background: var(--os-alert-danger-border);
    }
  }

  .o-button-link {
    cursor: pointer;
    text-decoration: none;
    color: var(--os-action-color);
    font-weight: 500;
    &:hover,
    &:active {
      color: var(--os-action-color-hover);
    }
  }

  .o-button-icon {
    cursor: pointer;
    color: var(--os-text-body-muted);
    font-weight: 500;
    &:hover,
    &:active {
      color: var(--os-text-body);
    }
  }

  .o-spreadsheet-bottombar-wrapper {
    z-index: calc(var(--os-components-importance-scroll-bar) + 1);
  }

  .o-checkers-background {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10'><path fill='#d9d9d9' d='M5 5h5v5H5zH0V0h5'/></svg>");
  }
  &.dark {
    .os-theme-dependant {
      filter: var(--os-dark-mode-filter);
    }
  }

  --oi-font-size: var(--os-icon-font-size);

  .os-canvas-background {
    background-color: var(--os-canvas-background-color);
  }
}
