:root {
  font-family:
    "Aptos",
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;

  --page: #e7dfd3;
  --surface: #f8f4ed;
  --surface-strong: #fffdf9;

  --text: #322f2a;
  --muted: #817a70;

  --green: #64745a;
  --green-dark: #4e5e46;
  --green-soft: #e4e9df;

  --border: #ddd4c7;

  --red: #a55247;
  --red-soft: #f1dfdc;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: min(100%, 620px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 14px 24px;
  background: var(--surface);
}


/* Header */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.heading {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.025em;
}

#statusText {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.new-list-btn {
  min-height: 38px;
  padding: 7px 14px;
  border: 0;
  border-radius: 9px;
  background: var(--green);
  color: white;
  font-weight: 650;
  white-space: nowrap;
}

.new-list-btn:hover {
  background: var(--green-dark);
}


/* Inmatning */

.add-section {
  position: relative;
  margin-bottom: 16px;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

#productInput {
  width: 100%;
  height: 40px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  background: var(--surface-strong);
  color: var(--text);
}

#productInput::placeholder {
  color: #9a9388;
}

#productInput:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgb(100 116 90 / 12%);
}

.add-btn {
  height: 40px;
  padding: 6px 14px;
  border: 0;
  border-radius: 9px;
  background: var(--green);
  color: white;
  font-weight: 650;
}

.add-btn:hover {
  background: var(--green-dark);
}


/* Autocomplete */

.suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  overflow: hidden;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: var(--surface-strong);
  box-shadow: 0 8px 22px rgb(50 47 42 / 13%);
}

.suggestion {
  display: block;
  width: 100%;
  padding: 9px 11px;

  border: 0;
  border-bottom: 1px solid #ebe5dc;

  background: transparent;
  color: var(--text);

  text-align: left;
}

.suggestion:last-child {
  border-bottom: 0;
}

.suggestion:hover {
  background: var(--green-soft);
}

.hidden {
  display: none;
}


/* Lista */

.list-heading {
  display: flex;
  align-items: center;
  gap: 7px;

  margin: 0 1px 6px;

  color: #5f5a52;
  font-size: .85rem;
  font-weight: 700;
}

.count {
  display: inline-grid;
  place-items: center;

  min-width: 22px;
  height: 20px;
  padding: 0 6px;

  border-radius: 10px;

  background: var(--green-soft);
  color: var(--green-dark);

  font-size: .75rem;
}

.list {
  display: grid;
  gap: 4px;
}


/*
 * Ca 40 px per rad.
 * 12 varor kräver ungefär 480 px vertikalt.
 */
.item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 34px;
  align-items: center;

  min-height: 40px;
  padding: 3px 4px;

  border: 1px solid #e4ddd3;
  border-radius: 8px;

  background: var(--surface-strong);
}

.item-name {
  min-width: 0;
  padding: 0 5px;

  overflow-wrap: anywhere;

  font-size: .96rem;
  line-height: 1.15;
  font-weight: 550;
}


/* Avprickning */

.item-check {
  appearance: none;

  display: grid;
  place-content: center;

  width: 20px;
  height: 20px;
  margin: 0 auto;

  border: 2px solid #9ba492;
  border-radius: 6px;

  background: white;
}

.item-check::before {
  content: "";
  width: 9px;
  height: 5px;

  border-left: 2px solid white;
  border-bottom: 2px solid white;

  transform: rotate(-45deg) scale(0);
  transition: transform 90ms ease;
}

.item-check:checked {
  border-color: var(--green);
  background: var(--green);
}

.item-check:checked::before {
  transform: rotate(-45deg) scale(1);
}

.done-item {
  background: #f0eee8;
}

.done-item .item-name {
  color: #9a958d;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}


/* Ta bort */

.delete-btn {
  display: grid;
  place-items: center;

  width: 30px;
  height: 30px;
  padding: 0;

  border: 0;
  border-radius: 7px;

  background: var(--red-soft);
  color: var(--red);

  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1;
}

.delete-btn:hover {
  background: #ead0cc;
  color: #873f36;
}


/* Tom lista */

.empty {
  padding: 18px 10px;

  border: 1px dashed #cec5b9;
  border-radius: 9px;

  color: var(--muted);
  text-align: center;
  font-size: .88rem;
}


/* Lite större skärmar */

@media (min-width: 650px) {
  body {
    padding: 22px 0;
  }

  .app {
    min-height: calc(100vh - 44px);
    border-radius: 18px;
    box-shadow: 0 8px 30px rgb(50 47 42 / 8%);
  }
}


/* Smala telefoner */

@media (max-width: 380px) {
  .app {
    padding-left: 10px;
    padding-right: 10px;
  }

  h1 {
    font-size: 1.55rem;
  }

  .new-list-btn,
  .add-btn {
    padding-left: 11px;
    padding-right: 11px;
  }
}
