:root {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #18362c;
  background: #f5f7f6;
  font-size: 16px;
  --green: #176a4c;
  --theme-green: #176a4c;
  --theme-blue: #245c86;
  --theme-red: #983f39;
  --theme-plum: #684772;
  --line: #dce5df;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
main {
  max-width: 900px;
  margin: auto;
  padding: 28px 24px 40px;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 650;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #e1a328;
  outline-offset: 3px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}
.brand-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: var(--green);
  color: white;
  font-size: 28px;
}
.eyebrow {
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  color: #557466;
}
h1 {
  font-size: 1.55rem;
  letter-spacing: -0.05em;
  line-height: 1;
  margin: 7px 0 0;
}
h2 {
  font-size: 2.4rem;
  line-height: 1.13;
  letter-spacing: -0.05em;
  margin: 16px 0;
}
h3 {
  margin: 0 0 20px;
  font-size: 1.35rem;
}
.quiet {
  background: transparent;
  color: #4c685b;
}
.outline {
  border: 1px solid #c6d9cd;
  background: white;
  color: var(--green);
}
.primary {
  background: var(--green);
  color: white;
  width: 100%;
  margin-top: 12px;
}
.auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding-top: 56px;
  align-items: center;
}
.intro p {
  max-width: 330px;
  color: #597166;
  line-height: 1.7;
}
.pill {
  display: inline-block;
  background: #e4efe8;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--green);
}
.card {
  padding: 28px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 12px 40px #17372b08;
}
label {
  display: block;
  color: #385748;
  font-size: 0.9rem;
  font-weight: 600;
}
label input:not([type="checkbox"]),
select {
  display: block;
  width: 100%;
  margin: 8px 0 20px;
  border: 1px solid #ccd9d0;
  border-radius: 12px;
  padding: 13px;
  background: #fff;
  color: #18362c;
  min-height: 48px;
}
.muted {
  color: #60766a;
  font-size: 0.875rem;
  line-height: 1.6;
}
.welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 34px 0 20px;
}
.welcome h2 {
  margin-bottom: 0;
  font-size: 2.2rem;
}
.basket {
  font-size: 56px;
  background: #e6eee8;
  border-radius: 50%;
  padding: 20px;
}
.toolbar {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}
.tabs {
  display: flex;
  padding: 5px;
  background: #e5ece7;
  border-radius: 16px;
  gap: 4px;
}
.tabs button {
  background: transparent;
  color: #587364;
  min-width: 120px;
}
.tabs .active {
  background: #fff;
  color: var(--green);
  box-shadow: 0 2px 6px #1431230c;
}
.tabs span {
  font-size: 0.8rem;
  margin-left: 5px;
  background: #deeee3;
  border-radius: 8px;
  padding: 2px 6px;
}
.summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}
.summary p {
  font-weight: 650;
}
#sync {
  color: #647c6c;
  font-size: 0.8rem;
  text-align: right;
}
.progress {
  height: 6px;
  border-radius: 10px;
  background: #dce9df;
  margin: 0 0 20px;
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: var(--green);
  transition: width 0.25s;
}
.search {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background: white;
  border-radius: 13px;
  padding: 0 14px;
  gap: 10px;
}
.search span {
  font-size: 28px;
  color: #758b7c;
}
.search input {
  border: 0 !important;
  margin: 0 !important;
  outline-offset: -2px;
  box-shadow: none;
  background: transparent !important;
}
.filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 10px;
}
.filters label {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.filters input {
  accent-color: var(--green);
  width: 18px;
  height: 18px;
}
.filters .quiet {
  font-size: 0.85rem;
  padding-right: 0;
}
.section {
  margin: 28px 0;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 3px 10px;
}
.section h3 {
  font-size: 0.82rem;
  letter-spacing: 0.07em;
  margin: 0;
  color: #516c5e;
  font-weight: 750;
}
.section small {
  font-size: 0.8rem;
  color: #6b8273;
}
.products {
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  overflow: hidden;
}
.product {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 10px 14px;
  border-bottom: 1px solid #edf1ee;
}
.product:last-child {
  border-bottom: 0;
}
.product label {
  display: flex;
  align-items: center;
  gap: 13px;
  flex: 1;
  cursor: pointer;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 500;
  min-width: 0;
}
.product input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--green);
  flex: none;
}
.product .quantity {
  width: 93px;
  min-height: 40px;
  border: 1px solid #e0e8e2;
  border-radius: 8px;
  padding: 9px;
  font-size: 0.85rem;
  text-align: center;
  color: #42634e;
  background: #f8faf8;
}
.product .quantity::placeholder {
  color: #84958a;
}
.product .name {
  display: block;
}
.product small {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: #7a8c80;
  margin-top: 3px;
}
.product.bought {
  background: #f0f7f1;
}
.product.bought .name {
  text-decoration: line-through;
  color: #83988a;
}
.empty {
  padding: 36px 24px;
  border: 1px dashed #c4d6c9;
  border-radius: 18px;
  text-align: center;
  color: #617d6a;
  line-height: 1.6;
}
.notice {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #8c302c;
  color: white;
  border-radius: 14px;
  padding: 16px 22px;
  max-width: 90%;
  z-index: 10;
  box-shadow: 0 4px 20px #0002;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 0;
  font-size: 0.75rem;
  color: #789080;
  border-top: 1px solid var(--line);
  margin-top: 30px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  width: min(440px, 92vw);
  color: #18362c;
}
dialog::backdrop {
  background: #102b1c88;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.dialog-head h2 {
  font-size: 1.5rem;
  margin: 0;
}
[hidden] {
  display: none !important;
}
@media (max-width: 600px) {
  main {
    padding: 20px 16px 28px;
  }
  .auth {
    grid-template-columns: 1fr;
    padding-top: 28px;
    gap: 22px;
  }
  .intro h2 {
    font-size: 2.4rem;
  }
  .intro p {
    margin-bottom: 0;
  }
  .card {
    padding: 24px;
  }
  .welcome {
    padding: 25px 0;
  }
  .welcome h2 {
    font-size: 1.9rem;
  }
  .basket {
    font-size: 32px;
    padding: 15px;
  }
  .tabs button {
    min-width: 92px;
    padding: 10px 12px;
  }
  .toolbar > .outline {
    font-size: 0.85rem;
    padding: 10px;
  }
  .product {
    padding: 8px 12px;
    gap: 8px;
  }
  .product .quantity {
    width: 76px;
  }
  .section {
    margin-top: 24px;
  }
  footer {
    flex-direction: column;
    gap: 6px;
  }
  .eyebrow {
    font-size: 0.7rem;
  }
}
.toolbar {
  flex-wrap: wrap;
}
.toolbar .tabs {
  margin-right: auto;
}
#finish-open {
  margin: 12px 0 4px;
}
#history-dialog {
  width: min(560px, 94vw);
  max-height: 85vh;
}
.history-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 12px 0;
  padding: 14px;
}
.history-card summary {
  cursor: pointer;
  line-height: 1.6;
  font-weight: 650;
}
.history-card ul {
  list-style: none;
  padding: 0;
}
.history-card li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.history-card h3 {
  margin: 16px 0 5px;
  font-size: 0.85rem;
  color: #60766a;
}
.history-card small {
  display: block;
  color: #60766a;
  font-weight: 400;
}
.history-item-qty {
  color: #60766a;
  font-size: 0.85rem;
  margin-left: 10px;
}

.dialog-error {
  white-space: pre-line;
  color: #a52c23;
}
#add-similar-label input {
  width: auto;
}

body {
  background: #f5f7f6;
  color: #18362c;
}
.btn-success {
  --bs-btn-bg: var(--green);
  --bs-btn-border-color: var(--green);
}
.btn.quiet {
  text-decoration: none;
}
.form-check-input:checked {
  background-color: var(--green);
  border-color: var(--green);
}
.product.list-group-item {
  display: flex;
  border-left: 0;
  border-right: 0;
  border-top: 0;
}
.toolbar > .btn {
  white-space: nowrap;
}

.main-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  margin-bottom: 12px;
}

.main-tabs button {
  min-width: 0;
  min-height: 52px;
  padding: 10px 6px;
  white-space: nowrap;
  font-size: 1.05rem;
}

.main-tabs .active {
  color: #fff;
  background: var(--green);
}

.main-tabs .active span {
  color: var(--green);
}

#list-app {
  margin-top: 16px;
}

.list-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.list-actions .btn {
  min-width: 0;
  padding: 6px 4px;
  font-size: 0.82rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.shopping-options {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.shopping-options select {
  min-height: 40px;
  margin: 3px 0;
  padding: 6px 32px 6px 10px;
}

#list-app .summary {
  margin: 8px 0;
}

#list-app .summary p {
  margin: 0;
}

#list-app .section {
  margin: 12px 0;
}

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

.search-row .search {
  gap: 6px;
  padding: 0 10px;
}

.search-row .search input {
  min-width: 0;
  min-height: 42px;
  padding: 6px;
}

.search-row #reset {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.4rem;
}

:root[data-theme="blue"] {
  --green: var(--theme-blue);
}
:root[data-theme="red"] {
  --green: var(--theme-red);
}
:root[data-theme="plum"] {
  --green: var(--theme-plum);
}

.dialog-close {
  border-radius: 12px;
  flex-shrink: 0;
  margin-left: 8px;
}

.profile-settings {
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  min-height: 46px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--green);
  font-size: 1.85rem;
  line-height: 1;
}

.profile-settings:hover,
.profile-settings:focus-visible {
  background-color: color-mix(in srgb, var(--green) 10%, white);
  color: var(--green);
}

.connected-name {
  margin: 0 2px 6px;
  color: #60766a;
  font-size: 0.82rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.statistics-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(88px, 100%), 1fr));
  gap: 6px;
}

.statistics-totals > div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
}

.statistics-totals dt {
  font-size: 0.8rem;
}
.statistics-totals dd {
  margin: 0;
  color: var(--green);
  font-size: 1.3rem;
  font-weight: 700;
}

.statistics-ranking {
  padding-left: 1.4rem;
}
.statistics-ranking li {
  padding: 4px 0;
}
.statistics-ranking strong {
  margin-left: 0.5rem;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(126px, 100%), 1fr));
  gap: 8px;
}

.theme-option {
  --swatch: var(--theme-green);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  line-height: 1.2;
}

.theme-option:has(input[value="blue"]) {
  --swatch: var(--theme-blue);
}
.theme-option:has(input[value="red"]) {
  --swatch: var(--theme-red);
}
.theme-option:has(input[value="plum"]) {
  --swatch: var(--theme-plum);
}

.theme-option:has(input:checked) {
  border-color: var(--swatch);
  background-color: color-mix(in srgb, var(--swatch) 9%, white);
}

.theme-option input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  clip-path: inset(50%);
}

.theme-option:has(input:focus-visible) {
  outline: 2px solid var(--swatch);
  outline-offset: 2px;
}

.theme-swatch {
  display: grid;
  place-items: center;
  flex: 0 0 23px;
  height: 23px;
  border-radius: 50%;
  background-color: var(--swatch);
  color: white;
}

.theme-option input:checked + .theme-swatch::after {
  content: "✓";
}

.btn-outline-success {
  --bs-btn-color: var(--green);
  --bs-btn-border-color: var(--green);
  --bs-btn-hover-bg: var(--green);
  --bs-btn-hover-border-color: var(--green);
  --bs-btn-active-bg: var(--green);
  --bs-btn-active-border-color: var(--green);
  --bs-btn-disabled-color: var(--green);
  --bs-btn-disabled-border-color: var(--green);
}

.btn-success {
  --bs-btn-hover-bg: color-mix(in srgb, var(--green), black 14%);
  --bs-btn-hover-border-color: var(--bs-btn-hover-bg);
  --bs-btn-active-bg: var(--bs-btn-hover-bg);
  --bs-btn-active-border-color: var(--bs-btn-hover-bg);
  --bs-btn-disabled-bg: var(--green);
  --bs-btn-disabled-border-color: var(--green);
}

:root:not([data-theme="green"]) .main-tabs,
:root:not([data-theme="green"]) .tabs span,
:root:not([data-theme="green"]) .pill,
:root:not([data-theme="green"]) .product.bought {
  background-color: color-mix(in srgb, var(--green) 11%, white);
}

.product input[type="checkbox"],
.shopping-options input[type="checkbox"] {
  accent-color: var(--green);
}

@media (min-width: 768px) {
  #list-app[data-mode="prepare"] #groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 0 16px;
  }

  #list-app #groups > .empty {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  header {
    padding-bottom: 10px;
  }

  #list-app {
    margin-top: 10px;
  }
}
