/**
 * settings.css — сторінка «Налаштування» (pages/settings-v2.html, #269).
 *
 * Ширину й відступи дає .ls-page (list-shell.css), як усім сторінкам
 * каркаса. Кольори — лише токени: сторінка живе в обох темах.
 */

.st { display: grid; gap: var(--space-5); align-content: start; }

/* ── Вкладки ─────────────────────────────────────────────────────────── */

.st-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  justify-self: start;
  border-radius: var(--radius-md);
  background: var(--color-surface-container);
}
.st-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font: 600 var(--text-md) var(--font-family);
  cursor: pointer;
}
.st-tab .material-icons-round { font-size: 18px; }
.st-tab:hover { color: var(--color-text); }
.st-tab[aria-selected="true"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-1); }
.st-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.st-pane { display: grid; gap: var(--space-5); align-content: start; }
.st-pane[hidden] { display: none; }

.st-lead { margin: 0; max-width: 760px; color: var(--color-text-secondary); font-size: var(--text-md); line-height: 1.5; }

/* ── Картка ──────────────────────────────────────────────────────────── */

.st-card {
  border: 1px solid var(--color-outline-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}
.st-card-h {
  display: flex; align-items: center; gap: 10px;
  padding: var(--space-4) var(--space-4) var(--space-3);
}
.st-card-h h2 { margin: 0; flex: 1; font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; color: var(--color-text); }
.st-card-h .st-n { font: 600 var(--text-base) var(--font-mono); color: var(--color-text-muted); }
.st-card-note { margin: 0; padding: 0 var(--space-4) var(--space-3); color: var(--color-text-muted); font-size: var(--text-base); line-height: 1.45; }

/* ── Додавання: кнопка й форма в панелі, як у мобільному застосунку ───── */

.st-own-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }

.st-type { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: var(--space-4); }
.st-type button {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 8px;
  border: 1.5px solid var(--color-outline-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font: 600 var(--text-md) var(--font-family);
  cursor: pointer;
}
.st-type button .material-icons-round { font-size: 24px; }
.st-type button:hover { background: var(--color-surface-variant); }
.st-type button[aria-checked="true"] { border-color: var(--color-primary); background: var(--color-primary-50); color: var(--color-primary-text); }
.st-type button:focus-visible { outline: none; box-shadow: var(--focus-ring); }

[data-for][hidden] { display: none; }
.st-label { display: block; margin-bottom: 6px; font-size: var(--text-base); font-weight: 600; color: var(--color-text-muted); }
.st-in {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-md);
  background: var(--color-surface-container);
  color: var(--color-text);
  font: 500 var(--text-lg) var(--font-family);
}
.st-in:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--focus-ring); }
.st-hint { margin: 8px 0 0; font-size: var(--text-base); color: var(--color-text-muted); line-height: 1.45; }

.st-found { min-height: 20px; margin-top: 8px; font-size: var(--text-base); color: var(--color-text-muted); line-height: 1.45; }
.st-found:empty { min-height: 0; }
.st-found.is-ok {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-50);
  color: var(--color-primary-text);
  font-size: var(--text-md); font-weight: 600;
}
.st-found.is-ok .material-icons-round { font-size: 18px; }
.st-found.is-warn { color: var(--color-error-500); }

.st-picks { margin-top: var(--space-4); }
.st-picks:empty { display: none; }
.st-picks .st-opt { border-radius: var(--radius-sm); }

.st-btn.is-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.st-btn.is-primary:hover { background: var(--color-primary-700); }
.st-btn:disabled { opacity: .45; cursor: not-allowed; }

.st-res-h {
  padding: 10px 14px 4px;
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--color-text-muted);
}
.st-opt {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 14px;
  border: 0; background: transparent;
  color: var(--color-text);
  font: inherit; text-align: left;
  cursor: pointer;
}
.st-opt:hover { background: var(--color-primary-50); }
.st-opt:focus-visible { outline: none; background: var(--color-primary-50); }
.st-opt .st-ic { flex-shrink: 0; }
.st-opt-t { flex: 1; min-width: 0; }
.st-opt-t b { display: block; font-weight: 600; font-size: var(--text-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-opt-t small { display: block; margin-top: 1px; color: var(--color-text-muted); font-size: var(--text-base); }

/* ── Списки своїх ────────────────────────────────────────────────────── */

.st-lists { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }

.st-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px var(--space-4);
  border-top: 1px solid var(--color-outline-subtle);
}
.st-row-t { flex: 1; min-width: 0; }
.st-row-t b { display: block; font-weight: 600; font-size: var(--text-md); color: var(--color-text); overflow-wrap: anywhere; }
.st-row-t small { display: block; margin-top: 1px; font: 500 var(--text-base) var(--font-mono); color: var(--color-text-muted); }
.st-row-t small.is-warn { font-family: var(--font-family); color: var(--color-error-500); }

.st-ic {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--color-primary-50);
  color: var(--color-primary-text);
}
.st-ic .material-icons-round { font-size: 19px; }
.st-ic.is-person { background: var(--color-secondary-50); color: var(--color-secondary-700); }

.st-del {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--color-text-muted);
  cursor: pointer;
}
.st-del .material-icons-round { font-size: 20px; }
.st-del:hover { background: var(--color-error-50); color: var(--color-error-500); }
.st-del:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.st-empty { padding: 14px var(--space-4) 18px; border-top: 1px solid var(--color-outline-subtle); color: var(--color-text-muted); font-size: var(--text-base); line-height: 1.45; }

/* ── Сівозміна: культура за культурою ───────────────────────────────── */

/* Кольори оцінок — одні на смужку, крапку в меню й підпис кошика */
[data-q="excellent"]    { --st-q: var(--color-primary);     --st-q-bg: var(--color-primary-50); }
[data-q="good"]         { --st-q: var(--color-primary-400); --st-q-bg: var(--color-primary-50); }
[data-q="satisfactory"] { --st-q: var(--color-secondary-500); --st-q-bg: var(--color-secondary-50); }
[data-q="poor"]         { --st-q: var(--color-error-500);   --st-q-bg: var(--color-error-50); }
[data-q="none"]         { --st-q: var(--color-outline);     --st-q-bg: var(--color-surface-container); }

.st-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 0 0 1px var(--color-outline); }
.st-dot.is-lg { width: 14px; height: 14px; }

.st-rot { display: grid; grid-template-columns: 260px minmax(0, 1fr); }

.st-rot-list {
  display: flex; flex-direction: column;
  padding: 6px;
  border-right: 1px solid var(--color-outline-subtle);
  background: var(--color-surface-container);
}
.st-rl {
  display: grid; gap: 6px;
  padding: 9px 10px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font: inherit; text-align: left;
  cursor: pointer;
}
.st-rl:hover { background: var(--color-surface-variant); }
.st-rl[aria-pressed="true"] { background: var(--color-surface); box-shadow: var(--shadow-1); }
.st-rl:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.st-rl-t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: var(--text-md); }
.st-mark {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--color-primary-50);
  color: var(--color-primary-text);
  font-size: var(--text-xs); font-weight: 700;
}
.st-bar { display: flex; gap: 1px; height: 4px; border-radius: 2px; overflow: hidden; background: var(--color-outline-subtle); }
.st-bar i { display: block; background: var(--st-q, transparent); }

.st-rot-body { padding: var(--space-5); display: grid; gap: var(--space-4); align-content: start; }
.st-rd-h { display: flex; align-items: center; gap: 10px; }
.st-rd-h h3 { margin: 0; font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; color: var(--color-text); }

.st-rd-sec {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-outline-subtle);
  border-radius: var(--radius-md);
}
.st-rd-l b { display: block; font-size: var(--text-md); color: var(--color-text); }
.st-rd-l small { font-size: var(--text-sm); color: var(--color-text-muted); }
.st-rd-ret { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-md); color: var(--color-text-secondary); }

.st-rd-sub { margin-top: var(--space-2); font-size: var(--text-md); font-weight: 700; color: var(--color-text); }
.st-rd-sub span { font-weight: 500; color: var(--color-text-muted); font-size: var(--text-base); }

.st-bucket {
  display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: var(--space-3); align-items: start;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--st-q-bg);
  border-left: 4px solid var(--st-q);
}
.st-bucket-h b { display: block; font-size: var(--text-md); color: var(--color-text); }
.st-bucket-h small { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.35; }
.st-bucket-c { display: flex; flex-wrap: wrap; gap: 6px; }
.st-bucket-e { padding: 6px 2px; color: var(--color-text-disabled); }

.st-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--color-outline-subtle);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font: 600 var(--text-base) var(--font-family);
  cursor: pointer;
}
.st-chip:hover { border-color: var(--color-outline); box-shadow: var(--shadow-1); }
.st-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
/* Змінене вами — пунктирна рамка кольору кошика: видно, що це не норма */
.st-chip.is-own { border: 1.5px dashed var(--st-q); }
.st-bucket[data-q] .st-chip.is-own { border-color: var(--st-q); }

.st-rd-foot { display: flex; justify-content: flex-end; }

/* Меню оцінки біля культури */
.st-menu {
  position: fixed; z-index: calc(var(--z-overlay) + 10);
  display: grid; min-width: 230px;
  padding: 6px;
  border: 1px solid var(--color-outline-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-4);
}
.st-menu-h { padding: 6px 8px 6px; font-size: var(--text-sm); color: var(--color-text-muted); }
.st-menu-h b { color: var(--color-text); }
.st-menu button {
  display: flex; align-items: center; gap: 9px;
  padding: 8px;
  border: 0; border-radius: var(--radius-xs);
  background: transparent; color: var(--color-text);
  font: 600 var(--text-md) var(--font-family); text-align: left;
  cursor: pointer;
}
.st-menu button:hover, .st-menu button:focus-visible { outline: none; background: var(--color-surface-variant); }
.st-menu button[aria-checked="true"] { background: var(--color-primary-50); color: var(--color-primary-text); }
.st-menu .is-reset { margin-top: 4px; border-top: 1px solid var(--color-outline-subtle); border-radius: 0; color: var(--color-text-secondary); font-weight: 500; }
.st-menu .is-reset .material-icons-round { font-size: 17px; }
.st-qdot { width: 12px; height: 12px; border-radius: 50%; background: var(--st-q); flex-shrink: 0; }

.st-step { display: inline-flex; align-items: center; border: 1px solid var(--color-outline); border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface); }
.st-step button {
  width: 30px; height: 30px;
  border: 0; background: var(--color-surface);
  color: var(--color-text-secondary);
  font: 700 var(--text-lg) var(--font-family);
  cursor: pointer;
}
.st-step button:hover:not(:disabled) { background: var(--color-surface-variant); color: var(--color-text); }
.st-step button:disabled { opacity: .35; cursor: default; }
.st-step button:focus-visible { outline: none; box-shadow: inset var(--focus-ring); }
.st-step output { min-width: 58px; text-align: center; font: 600 var(--text-base) var(--font-family); color: var(--color-text); font-variant-numeric: tabular-nums; }

.st-reset {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--color-primary-text);
  cursor: pointer;
}
.st-reset .material-icons-round { font-size: 17px; }
.st-reset:hover { background: var(--color-primary-50); }
.st-reset:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.st-reset[hidden] { visibility: hidden; display: inline-flex; }

.st-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px;
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text);
  font: 600 var(--text-base) var(--font-family);
  cursor: pointer;
}
.st-btn .material-icons-round { font-size: 17px; }
.st-btn:hover { background: var(--color-surface-variant); }
.st-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ── Телефон ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .st-own-bar { flex-direction: column; }
  .st-own-bar .st-btn { align-self: stretch; justify-content: center; padding: 11px; }
  .st-tabs { justify-self: stretch; }
  .st-tab { flex: 1; justify-content: center; padding: 8px 6px; }
  .st-lists { grid-template-columns: 1fr; }
  /* Список культур — смуга, що гортається, над кошиками */
  .st-rot { grid-template-columns: 1fr; }
  .st-rot-list {
    flex-direction: row; overflow-x: auto; scrollbar-width: none;
    border-right: 0; border-bottom: 1px solid var(--color-outline-subtle);
  }
  .st-rot-list::-webkit-scrollbar { display: none; }
  .st-rl { flex: 0 0 auto; min-width: 150px; }
  .st-rot-body { padding: var(--space-4); }
  .st-bucket { grid-template-columns: 1fr; gap: var(--space-2); }
}

/* Вимикач — перемикач, а не галочка: стан видно здалеку */
.st-switch { display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; }
.st-switch input { position: absolute; opacity: 0; pointer-events: none; }
.st-switch-ui { position: relative; flex: none; width: 44px; height: 26px; margin-top: 2px; border-radius: var(--radius-full); background: var(--color-outline); transition: background .15s; }
.st-switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--color-surface); box-shadow: var(--shadow-1); transition: transform .15s; }
.st-switch input:checked + .st-switch-ui { background: var(--color-primary); }
.st-switch input:checked + .st-switch-ui::after { transform: translateX(18px); }
.st-switch input:focus-visible + .st-switch-ui { box-shadow: var(--focus-ring); }
.st-switch input:disabled + .st-switch-ui { opacity: .5; }
.st-switch-t { display: flex; flex-direction: column; gap: 2px; color: var(--color-text-secondary); font-size: var(--text-base); }
.st-switch-t b { color: var(--color-text); font-weight: 600; }
.st-tab[hidden] { display: none; }
