* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #fff;
  color: #111;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

main {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding:
    max(20px, env(safe-area-inset-top))
    12px
    max(20px, env(safe-area-inset-bottom));
}

.app-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  column-gap: 4px;
  align-items: baseline;
  margin-bottom: 18px;
}

h1 {
  grid-column: 2;
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 700;
}

#entries {
  width: 100%;
}

.entry,
.global-reset-row {
  display: grid;
  grid-template-columns:
    44px
    minmax(0, 1fr)
    44px
    44px
    44px;
  column-gap: 4px;
  align-items: center;
  padding: 7px 0;
}

.entry {
  grid-template-areas:
    "delete main plus minus reset"
    ".      date .    .     .";
  row-gap: 2px;
}

.global-reset-row {
  grid-template-areas: ". . . . global-reset";
}

.main-value {
  grid-area: main;
  min-width: 0;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.date {
  grid-area: date;
  min-width: 0;
  color: #666;
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.date:empty {
  display: none;
}

.date.old {
  color: #f26924;
  font-weight: 700;
}

button,
.sign-in {
  margin: 0;
  border: 1px solid #bbb;
  border-radius: 8px;
  background: #f6f6f6;
  color: #111;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

button:active,
.sign-in:active {
  background: #e7e7e7;
}

button:disabled {
  opacity: 0.45;
}

button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.text-button {
  grid-column: 3;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  padding: 4px 0 4px 8px;
  background: transparent;
  color: #666;
  font-size: 13px;
}

.delete {
  grid-area: delete;
}

.plus {
  grid-area: plus;
  font-size: 28px;
  line-height: 1;
}

.minus {
  grid-area: minus;
  font-size: 30px;
  line-height: 1;
}

.reset {
  grid-area: reset;
}

.global-reset {
  grid-area: global-reset;
}

hr {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid #bbb;
}

.add-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  column-gap: 4px;
  align-items: center;
}

#newName {
  grid-column: 2;
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid #aaa;
  border-radius: 8px;
  padding: 0 10px;
  outline: none;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 18px;
}

#newName:focus {
  border-color: #555;
}

#addButton {
  grid-column: 3;
}

.status,
.login-view,
noscript {
  margin: 0 0 0 48px;
  color: #555;
}

.sign-in {
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

@media (max-width: 380px) {
  main {
    padding-left: 8px;
    padding-right: 8px;
  }

  .app-header {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    column-gap: 3px;
  }

  .entry,
  .global-reset-row {
    grid-template-columns:
      42px
      minmax(0, 1fr)
      42px
      42px
      42px;
    column-gap: 3px;
  }

  button {
    width: 42px;
    height: 42px;
  }

  .text-button {
    width: auto;
    height: auto;
  }

  .main-value {
    font-size: 19px;
  }

  .add-row {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    column-gap: 3px;
  }

  #newName {
    height: 42px;
  }

  .status,
  .login-view,
  noscript {
    margin-left: 45px;
  }
}
