@import "tailwindcss";

:root {
  --bg-normal:#eee;
  --bg-current:#d6f8ff;
  --bg-green:#e1ffe2;
  --bg-red:#ffe1e1;
  --font-normal:#444;
  --font-green:#00ba06;
  --font-red:#ff4949;
  --gap-cell:5px;
  --padding-cell: 10px;
}

* {
	padding: 0px;
	margin: 0px;
	border: none;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

main {
  .table {
    max-width:800px;
    margin-inline:auto;
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap:var(--gap-cell);
    align-items: center;
    color:var(--font-normal);
    font-size:0.75em;
    font-weight:500;

    .table__head, .table__row {
      display:grid;
      grid-template-columns: 3fr 1fr 1fr 1fr;
      gap:var(--gap-cell);

      @media (width<=767px) {
        grid-template-columns: 2fr 1fr 1fr 1fr;
      }
    }
    .table__head {
      .table__cell{
        justify-content: center;
      }
    } 
    .table__row {
      cursor:pointer;

      .table__cell:first-child {
        justify-content: left;
      }
    } 
    .table__cell {
        background-color: var(--bg-normal);
        padding:var(--padding-cell);
        display:grid;
        justify-content: end;
  
        &.table__cell--current {
          background-color:var(--bg-current);
        }
        &.table__cell--balance {
          justify-content: end;
          grid-template-columns: auto 40px;
          gap:var(--gap-cell);
          
          span {
            color:var(--font-green);
            text-align: right;
          }
        }
        &.table__cell--more {
          justify-content: end;
          grid-template-columns: auto 40px;
          gap:var(--gap-cell);
          background-color:var(--bg-red);
          span {
            color:var(--font-red);
            text-align: right;
          }
        }
        &.table__cell--less {
          justify-content: end;
          grid-template-columns: auto 40px;
          gap:var(--gap-cell);
          background-color: var(--bg-green);
          span {
            color:var(--font-green);
            text-align: right;
          }
        }
       
        @media (width<=767px){
          &.table__cell--balance ,&.table__cell--more, &.table__cell--less  {
            grid-template-columns:auto;
          }
        }
        
        &:last-child.table__cell--less, &:last-child.table__cell--more{
          grid-template-columns: auto;
        }
    }
  }
}