:root {
  --green: #1B472E;
  --green-light: #e8f0ea;
  --brown: #6E2306;
  --bg: #f5f5f0;
  --card: #fff;
  --text: #222;
  --muted: #777;
  --line: #e2e2dc;
  --red: #c62828;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }
.screen { min-height: 100vh; }
button { font: inherit; cursor: pointer; }
input { font: inherit; }

.login-form {
  max-width: 320px; margin: 15vh auto; padding: 24px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--card); border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.08); text-align: center;
}
.login-form h1 { margin: 0; color: var(--green); }
.login-form .subtitle { margin: 0 0 8px; color: var(--muted); }
.login-form input { padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 16px; }
.login-form button { padding: 12px; background: var(--green); color: #fff; border: none; border-radius: 8px; font-size: 16px; }
.error { color: var(--red); min-height: 1.2em; margin: 0; }

.top-sticky { position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 16px; background: var(--green); color: #fff;
}
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-title { font-weight: 600; white-space: nowrap; }
.header-logo { height: 26px; width: 26px; display: block; filter: brightness(0) invert(1); }
.header-right { display: flex; gap: 14px; }
.link-btn { background: none; border: none; color: #fff; text-decoration: underline; font-size: .9rem; padding: 0; }

.tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; padding: 10px; background: none; border: none; border-bottom: 3px solid transparent; color: var(--muted); }
.tabs button.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }

main { padding: 12px 16px 90px; max-width: 760px; margin: 0 auto; }
.hint { color: var(--muted); font-size: .85rem; margin: 4px 0 10px; }
.group-title { margin: 18px 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--brown); }

.row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 6px;
}
.row .info { flex: 1; min-width: 0; }
.row .name { font-weight: 600; }
.row .meta { font-size: .8rem; color: var(--muted); }
.row.off { opacity: .55; }
.tag { display: inline-block; font-size: .7rem; padding: 1px 6px; border-radius: 8px; background: var(--green-light); color: var(--green); margin-left: 4px; }
.tag.t-Спорен { background: #fff3e0; color: #b45309; }
.tag.t-Чист { background: #eef2ff; color: #3730a3; }

.num { width: 84px; padding: 9px 8px; border: 1px solid #ccc; border-radius: 8px; font-size: 16px; text-align: right; }
.net { width: 74px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.net.neg { color: var(--red); }
.not-for-sale { color: #b45309; }
.mistral-code { width: 76px; padding: 2px 4px; border: 1px solid #ddd; border-radius: 5px; font-size: 13px; }
.box-select { padding: 8px 6px; border: 1px solid #ccc; border-radius: 8px; font-size: 14px; background: #fff; max-width: 150px; }
.boxes { margin: 0 0 12px; }
.boxes .row { margin-top: 8px; }
.inline-form { display: flex; gap: 8px; margin-top: 8px; }
.inline-form input:first-child { flex: 1; padding: 10px; border: 1px solid #ccc; border-radius: 8px; font-size: 16px; }
.box-field { display: flex; flex-direction: column; align-items: flex-end; font-size: .7rem; color: var(--muted); }

/* превключвател */
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #ccc; border-radius: 26px; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(20px); }

.filters input[type=search] { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 8px; font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { padding: 6px 12px; border-radius: 16px; border: 1px solid var(--line); background: #fff; font-size: .85rem; }
.chip.active { background: var(--green); color: #fff; border-color: var(--green); }

.primary { background: var(--green); color: #fff; border: none; border-radius: 8px; padding: 11px 16px; font-size: 15px; }
.primary:disabled { opacity: .45; }
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line);
}
.add-tea { margin-top: 18px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.add-tea summary { cursor: pointer; color: var(--green); font-weight: 600; }
.add-tea form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.add-tea input { padding: 10px; border: 1px solid #ccc; border-radius: 8px; font-size: 16px; }

.rev { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.rev summary { padding: 10px 12px; cursor: pointer; }
.rev table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.rev th, .rev td { padding: 6px 12px; border-top: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.rev th:nth-child(2), .rev td:nth-child(2) { text-align: left; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: #333; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 50; }
