/* Бараны и кальян: шерсть, угли, дым */
:root {
  --bg: #f4ecdf;
  --bg-2: #efe3d0;
  --surface: #fffaf2;
  --surface-2: #f8f0e3;
  --ink: #2b1e16;
  --ink-2: #5a4636;
  --muted: #86725f;
  --line: #e5d8c4;
  --accent: #d9581f;        /* раскалённый уголь */
  --accent-ink: #fff6ec;
  --accent-soft: #fbe2d2;
  --smoke: #8f82a8;         /* дымок */
  --ok: #3d8a55;
  --bad: #c03a28;
  --bad-soft: #f9dcd5;
  --shadow: 0 1px 0 rgba(60, 35, 15, .05), 0 6px 18px -8px rgba(60, 35, 15, .25);
  --radius: 16px;

  --wool: #fffdf8;
  --wool-edge: #dccbb1;
  --face: #3a2a20;
  --horn: #b88a55;
  --metal: #9a8f86;
  --glass: rgba(120, 170, 190, .35);
  --water: rgba(90, 150, 180, .45);
  --puff: rgba(143, 130, 168, .35);

  --seg-0: #e0672e; --seg-1: #3fa58a; --seg-2: #b8426f;
  --seg-3: #e3b53c; --seg-4: #7b6cc4; --seg-5: #4f8fc8;

  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15100c; --bg-2: #1b140f; --surface: #211913; --surface-2: #2a2019;
    --ink: #f4eadb; --ink-2: #d5c4b0; --muted: #a39080; --line: #3a2d23;
    --accent: #ff7a3c; --accent-ink: #1a0f08; --accent-soft: #4a2414;
    --smoke: #b3a6cc; --ok: #6cc187; --bad: #ff7a66; --bad-soft: #4a1d16;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 24px -12px rgba(0,0,0,.7);
    --wool: #efe6d8; --wool-edge: #b9a68c; --face: #2a1d15; --horn: #c99a62;
    --metal: #8d847c; --glass: rgba(120, 170, 190, .22); --water: rgba(90, 150, 180, .35);
    --puff: rgba(190, 180, 215, .25);
    --seg-0: #ff8a4c; --seg-1: #4fc4a4; --seg-2: #e0679a; --seg-3: #f0c859; --seg-4: #9d8ff0; --seg-5: #6fb0ec;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15100c; --bg-2: #1b140f; --surface: #211913; --surface-2: #2a2019;
  --ink: #f4eadb; --ink-2: #d5c4b0; --muted: #a39080; --line: #3a2d23;
  --accent: #ff7a3c; --accent-ink: #1a0f08; --accent-soft: #4a2414;
  --smoke: #b3a6cc; --ok: #6cc187; --bad: #ff7a66; --bad-soft: #4a1d16;
  --wool: #efe6d8; --wool-edge: #b9a68c; --face: #2a1d15; --horn: #c99a62;
  --seg-0: #ff8a4c; --seg-1: #4fc4a4; --seg-2: #e0679a; --seg-3: #f0c859; --seg-4: #9d8ff0; --seg-5: #6fb0ec;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(circle at 12% -10%, var(--bg-2) 0 220px, transparent 221px),
    radial-gradient(circle at 92% 8%, var(--bg-2) 0 160px, transparent 161px),
    var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1, h2, h3 { font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif; line-height: 1.12; letter-spacing: -.01em; margin: 0 0 .4em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 750; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--accent); margin-bottom: .35rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- каркас ---------- */
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 20px 16px 48px; flex: 1; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px max(16px, calc((100% - 1160px) / 2 + 16px));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.2rem; font-family: ui-rounded, system-ui, sans-serif; }
.brand small { display: block; font-size: .7rem; font-weight: 600; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: -3px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 7px 12px; border-radius: 999px; font-weight: 600; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--ink); color: var(--surface); }
.who { display: flex; align-items: center; gap: 12px; }
.who form { margin: 0; }
.role { color: var(--ink); text-decoration: none; font-weight: 650; display: flex; flex-direction: column; line-height: 1.15; }
.role small { color: var(--muted); font-weight: 500; font-size: .72rem; }
.linkish { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 4px; }
.linkish:hover { color: var(--accent); }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px max(16px, calc((100% - 1160px) / 2 + 16px)); color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  .topbar { gap: 8px 12px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .who { margin-left: auto; }
}

/* ---------- элементы ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 650;
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { border-color: var(--ink); filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-sm { padding: 5px 11px; font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline { display: inline; margin: 0; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 12px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.form.narrow { max-width: 440px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 760px; }
.grid-form .span2 { grid-column: 1 / -1; }
@media (max-width: 600px) { .grid-form { grid-template-columns: 1fr; } }

.flashes { display: grid; gap: 8px; margin-bottom: 18px; }
.flash { padding: 11px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 550; }
.flash-ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); box-shadow: inset 4px 0 0 var(--ok); }
.flash-error { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); box-shadow: inset 4px 0 0 var(--bad); background: var(--bad-soft); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 0; flex-basis: 100%; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 32px 0 12px; }
.section-head h2 { margin: 0; }
.crumbs { margin: 0 0 10px; color: var(--muted); font-size: .9rem; }
.crumbs a { color: var(--ink-2); }
.empty { text-align: center; color: var(--ink-2); padding: 32px 20px; }
.empty p { margin: 0; }
.empty.big { padding: 40px 16px; }
.empty-art { width: 220px; margin: 0 auto 8px; display: block; }

/* шкалы */
.meter { display: inline-flex; align-items: center; gap: 7px; vertical-align: middle; }
.meter-bar { width: 58px; height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--seg-3), var(--accent)); }
.meter b { font-variant-numeric: tabular-nums; font-size: .9rem; min-width: 1.4em; }
.horns { display: inline-flex; align-items: center; gap: 2px; vertical-align: middle; }
.horns b { margin-left: 5px; font-variant-numeric: tabular-nums; font-size: .95rem; }
.horn-i {
  width: 16px; height: 16px; display: inline-block;
  -webkit-mask: url("horn.svg") center / contain no-repeat; mask: url("horn.svg") center / contain no-repeat;
  background: var(--line);
}
.horn-i.full { background: var(--horn); }
.horn-i.half { background: linear-gradient(90deg, var(--horn) 50%, var(--line) 50%); }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: .82rem; font-weight: 600; text-decoration: none; cursor: pointer; font-family: inherit; }
.tag small { color: var(--muted); font-weight: 500; }
.tag.on, a.tag:hover, button.tag:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tags { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.chip { display: inline-flex; gap: 8px; align-items: center; background: var(--accent-soft); border-radius: 999px; padding: 4px 6px 4px 12px; font-weight: 600; font-size: .9rem; }
.chip a { text-decoration: none; font-size: 1.1rem; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); }
.active-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.out-pill { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--bad); background: var(--bad-soft); padding: 2px 8px; border-radius: 99px; }
.warn-line { margin: 10px 0 0; font-size: .82rem; color: var(--bad); position: relative; z-index: 1; }

/* чекбокс-«уголёк» */
.check { position: relative; display: inline-grid; width: 24px; height: 24px; cursor: pointer; vertical-align: middle; }
.check input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; }
.check span { border: 2px solid var(--line); border-radius: 7px; background: var(--surface); transition: .15s; display: grid; place-items: center; }
.check input:checked + span { background: var(--bad); border-color: var(--bad); }
.check input:checked + span::after { content: ""; width: 10px; height: 6px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.check input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.check input:disabled + span { opacity: .5; }
.check-label { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; white-space: nowrap; }

/* фильтры */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; margin-bottom: 14px; }
.filters input[type=search] { flex: 1 1 240px; }
.filters select { flex: 0 1 200px; width: auto; }
.seg-control { display: inline-flex; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 999px; padding: 3px; }
.seg-control label { cursor: pointer; }
.seg-control input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-control span { display: block; padding: 5px 12px; border-radius: 999px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.seg-control input:checked + span { background: var(--ink); color: var(--surface); }
.seg-control input:focus-visible + span { outline: 3px solid var(--accent); }

/* таблицы */
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .b { font-weight: 700; }
.table .flavor { color: var(--ink); font-weight: 650; text-decoration: none; }
.table .flavor:hover { color: var(--accent); text-decoration: underline; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { margin-left: 4px; }
.stock-col { width: 44px; text-align: center !important; }
.stock-form { margin: 0; }
.desc-col { max-width: 320px; color: var(--ink-2); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
tr.is-out td:not(.stock-col) { opacity: .5; }
tr.is-out .flavor { text-decoration: line-through; }
.table.mini { font-size: .8rem; }
.table.mini th, .table.mini td { padding: 6px 8px; white-space: nowrap; }
@media (max-width: 760px) { .desc-col { display: none; } .table th, .table td { padding: 9px 8px; } }

/* ---------- hero и баран ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; min-height: 62vh; }
.hero h1 { font-size: clamp(2.6rem, 8vw, 4.6rem); line-height: .98; margin-bottom: .3em; }
.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 34em; }
.hero-art { width: 100%; max-width: 460px; justify-self: center; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 12px; } .hero-art { max-width: 300px; order: -1; } }

.welcome { display: grid; grid-template-columns: 1fr 240px; gap: 20px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 22px 24px; box-shadow: var(--shadow); }
.welcome h1 { margin-bottom: 14px; }
.welcome .actions { margin-top: 16px; }
.welcome-art { width: 100%; }
@media (max-width: 720px) { .welcome { grid-template-columns: 1fr; } .welcome-art { display: none; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
a.stat:hover { border-color: var(--accent); }
.stat b { font-size: 1.7rem; font-family: ui-rounded, system-ui, sans-serif; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--muted); }
.stat.bad b { color: var(--bad); }

.auth { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: center; max-width: 860px; margin: 3vh auto 0; }
.auth .form { max-width: 400px; width: 100%; }
.auth h1 { font-size: 1.8rem; }
.auth-art { width: 100%; max-width: 340px; justify-self: center; }
@media (max-width: 720px) { .auth { grid-template-columns: 1fr; } .auth-art { max-width: 200px; } }

.sheep-art { overflow: visible; }
.sheep-art .wool, .sheep-art .wool circle { fill: var(--wool); stroke: var(--wool-edge); stroke-width: 1.5; }
.sheep-art .face { fill: var(--face); }
.sheep-art .horn { fill: none; stroke: var(--horn); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.sheep-art .lid { fill: none; stroke: #f6e9d6; stroke-width: 2.5; stroke-linecap: round; }
.sheep-art .nose { fill: #5b4334; }
.sheep-art .leg { fill: var(--face); }
.sheep-art .mouthpiece { fill: var(--metal); }
.sheep-art .metal { fill: var(--metal); }
.sheep-art .bowl { fill: #b5623a; }
.sheep-art .coal { fill: var(--accent); animation: glow 2.6s ease-in-out infinite; }
.sheep-art .coal + .coal { animation-delay: -1.3s; }
.sheep-art .vase { fill: var(--glass); stroke: var(--metal); stroke-width: 2; }
.sheep-art .vase-water { fill: var(--water); }
.sheep-art .bubble { fill: rgba(255, 255, 255, .7); animation: bubble 1.8s ease-in infinite; }
.sheep-art .bubble.b2 { animation-delay: -.9s; }
.sheep-art .hose { stroke: var(--smoke); stroke-width: 6; stroke-linecap: round; }
.sheep-art .puff { fill: var(--puff); transform-box: fill-box; transform-origin: center; animation: puff 4.5s ease-out infinite; }
.sheep-art .p2 { animation-delay: -1.5s; }
.sheep-art .p3 { animation-delay: -3s; }
@keyframes glow { 50% { fill: #ffb347; } }
@keyframes bubble { from { transform: translateY(0); opacity: .8; } to { transform: translateY(-18px); opacity: 0; } }
@keyframes puff { 0% { transform: translate(-6px, 30px) scale(.4); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(10px, -30px) scale(1.25); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheep-art * { animation: none !important; } }

/* ---------- забивки ---------- */
.mix-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.mix-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; transition: transform .12s, border-color .12s; }
.mix-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.mix-link { position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
.mix-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mix-card time { font-weight: 700; color: var(--ink-2); font-size: .92rem; }
.mix-card footer { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; font-size: .85rem; color: var(--muted); }
.kv { display: inline-flex; gap: 6px; align-items: center; }
.bowl-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--line); }
.bowl-bar .seg { min-width: 4px; }
.bowl-bar.preview { height: 16px; margin-top: 12px; }
.seg-empty { background: transparent; }
.seg-0 { background: var(--seg-0); } .seg-1 { background: var(--seg-1); } .seg-2 { background: var(--seg-2); }
.seg-3 { background: var(--seg-3); } .seg-4 { background: var(--seg-4); } .seg-5 { background: var(--seg-5); }
.seg-stroke.seg-0 { stroke: var(--seg-0); background: none; } .seg-stroke.seg-1 { stroke: var(--seg-1); background: none; }
.seg-stroke.seg-2 { stroke: var(--seg-2); background: none; } .seg-stroke.seg-3 { stroke: var(--seg-3); background: none; }
.seg-stroke.seg-4 { stroke: var(--seg-4); background: none; } .seg-stroke.seg-5 { stroke: var(--seg-5); background: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.dot:not([class*="seg-"]) { background: var(--line); }
.mix-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.mix-items li { display: flex; align-items: baseline; gap: 8px; font-size: .93rem; }
.mix-items .dot { transform: translateY(1px); }
.pct { font-variant-numeric: tabular-nums; min-width: 2.6em; }
.tname { color: inherit; text-decoration: none; }
a.tname:hover .tf { color: var(--accent); text-decoration: underline; }
.tname .tb { font-weight: 700; }
.tname .tl { color: var(--muted); }
.tname .tf { font-weight: 550; }
.tname.gone { text-decoration: line-through; text-decoration-color: var(--bad); opacity: .65; }
.mix-items.big li { font-size: 1.05rem; }

.top-list { list-style: none; margin: 0; padding: 6px; }
.top-list li a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink); text-decoration: none; }
.top-list li a:hover { background: var(--surface-2); }
.top-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--surface); font-weight: 800; flex: none; }
.top-list li:first-child .top-n { background: var(--accent); }
.top-mix { flex: 1; min-width: 0; font-weight: 600; }
.top-mix small { color: var(--muted); font-weight: 500; }

.mix-full { display: flex; flex-direction: column; gap: 20px; padding: 24px; }
.mix-full-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.mix-full-head h1 { margin: 0; }
.facts { display: flex; gap: 22px; margin: 0; flex-wrap: wrap; }
.facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.facts dd { margin: 4px 0 0; font-weight: 600; }
.bowl-wrap { display: grid; grid-template-columns: 150px 1fr; gap: 24px; align-items: center; }
.bowl-donut { width: 150px; height: 150px; transform: rotate(0deg); }
@media (max-width: 520px) { .bowl-wrap { grid-template-columns: 1fr; } .bowl-donut { margin: 0 auto; width: 130px; height: 130px; } }
.desc { white-space: pre-wrap; background: var(--surface-2); border-radius: 12px; padding: 14px 16px; border: 1px solid var(--line); color: var(--ink-2); margin: 0; }
.mix-full footer { border-top: 1px solid var(--line); padding-top: 16px; }

.tob-hero { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; padding: 24px; }
.tob-hero h1 { margin-bottom: 14px; }
.tob-hero .desc { margin-top: 16px; max-width: 60ch; }
.tob-hero.is-out h1 { text-decoration: line-through; text-decoration-color: var(--bad); }

/* форма забивки */
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .row3 { grid-template-columns: 1fr 1fr; } .row3 label:first-child { grid-column: 1 / -1; } }
.bowl-fieldset { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.bowl-fieldset legend { font-weight: 800; padding: 0 6px; font-family: ui-rounded, system-ui, sans-serif; font-size: 1.05rem; }
#items { display: flex; flex-direction: column; gap: 8px; }
.item-row { display: grid; grid-template-columns: 12px 1fr 108px 36px; gap: 8px; align-items: center; }
.pct-input { flex-direction: row !important; align-items: center; gap: 4px !important; }
.pct-input input { text-align: right; }
.pct-input span { color: var(--muted); font-weight: 700; }
.bowl-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pct-sum { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.pct-sum.ok { color: var(--ok); }
.pct-sum.bad { color: var(--bad); }
.tob-filter { font-size: .9rem; }
@media (max-width: 520px) { .item-row { grid-template-columns: 10px 1fr 86px 30px; gap: 6px; } }

/* импорт */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }
.drop { position: relative; border: 2px dashed var(--line); border-radius: var(--radius); padding: 30px 16px; text-align: center; cursor: pointer; background: var(--surface-2); transition: .15s; }
.drop:hover, .drop:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-text { display: flex; flex-direction: column; gap: 4px; color: var(--ink); }
.drop-text small { color: var(--muted); font-weight: 500; }
.radios { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.radios legend { font-weight: 700; margin-bottom: 6px; color: var(--ink-2); font-size: .92rem; }
.radios label { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; }
.radios input { width: auto; accent-color: var(--accent); }
.help h2 { margin-bottom: 8px; }
.result { margin-top: 16px; }
.errors { color: var(--bad); font-size: .9rem; padding-left: 20px; max-height: 300px; overflow: auto; }

.danger-zone { margin-top: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.role-badge { padding: 4px 12px; border-radius: 99px; font-weight: 700; font-size: .85rem; background: var(--surface-2); border: 1px solid var(--line); }
.role-badge.role-admin { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.role-badge.role-hookahman { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.table select { width: auto; padding: 5px 10px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); z-index: 50; transition: opacity .4s, transform .4s; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.gone { opacity: 0; transform: translate(-50%, 10px); }

/* ---------- оценки, комментарии, лента ---------- */
.social-line { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; font-size: .82rem; color: var(--muted); position: relative; z-index: 0; }
.social-line .mine { color: var(--accent); font-weight: 700; }

.rate-card, .comments { margin-top: 16px; padding: 22px 24px; }
.rate-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rate-head h2 { margin: 0; }
.rate-form { margin: 0 0 6px; }
.rate-scale { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; max-width: 560px; }
.rate-opt { cursor: pointer; }
.rate-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rate-opt span {
  display: grid; place-items: center; height: 44px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface-2); font-weight: 800; font-variant-numeric: tabular-nums;
  transition: background .12s, border-color .12s, transform .08s;
}
.rate-opt:hover span { border-color: var(--horn); }
.rate-opt input:checked + span, .rate-opt.on span { background: var(--horn); border-color: var(--horn); color: #fff; }
.rate-opt input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.rate-scale:hover .rate-opt span { transform: none; }
@media (max-width: 480px) { .rate-scale { grid-template-columns: repeat(5, 1fr); } }
.voters { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.voter { background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; }

.comments h2 { margin-bottom: 14px; }
.comment-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.comment { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.comment-head .their { font-size: .8rem; color: var(--horn); font-weight: 700; }
.comment-del { margin-left: auto; }
.comment-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { gap: 8px; }

.pick { display: flex; flex-direction: column; gap: 8px; }
.pick .mix-card { flex: 1; }
.reasons { list-style: none; margin: 0; padding: 0 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.reason { font-size: .8rem; font-weight: 650; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
.reason-good { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.reason-warn { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.reason-info { color: var(--smoke); }
.tob-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tob-chip { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.tob-chip:hover { border-color: var(--accent); }
.tob-chip .eyebrow { margin: 0; }

/* ---------- шкала крепости ---------- */
:root { --sl-0: #4f9a6a; --sl-1: #7fa04a; --sl-2: #c49a2c; --sl-3: #d9772a; --sl-4: #d0502a; --sl-5: #b5302a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sl-0: #6cc187; --sl-1: #a6c46a; --sl-2: #e3bb4f; --sl-3: #f2934a; --sl-4: #ff7552; --sl-5: #ff5c52; } }
:root[data-theme="dark"] { --sl-0: #6cc187; --sl-1: #a6c46a; --sl-2: #e3bb4f; --sl-3: #f2934a; --sl-4: #ff7552; --sl-5: #ff5c52; }
.slabel { display: inline-block; font-size: .78rem; font-weight: 700; line-height: 1.3; padding: 2px 8px; border-radius: 99px; color: var(--sl-c, var(--muted)); background: color-mix(in srgb, var(--sl-c, var(--muted)) 13%, transparent); white-space: nowrap; }
.sl-0 { --sl-c: var(--sl-0); } .sl-1 { --sl-c: var(--sl-1); } .sl-2 { --sl-c: var(--sl-2); }
.sl-3 { --sl-c: var(--sl-3); } .sl-4 { --sl-c: var(--sl-4); } .sl-5 { --sl-c: var(--sl-5); }
.meter .slabel { margin-left: 2px; }
.facts .slabel { white-space: normal; }
.strength-hint { min-height: 1.3em; font-weight: 600; font-size: .82rem; white-space: normal; align-self: flex-start; }
.strength-hint:empty { padding: 0; background: none; }
.strength-legend { font-size: .88rem; color: var(--ink-2); }
.strength-legend summary { cursor: pointer; font-weight: 650; color: var(--ink-2); }
.strength-legend ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 5px; }
.strength-legend .slabel { min-width: 76px; text-align: center; margin-right: 6px; }
.mix-card footer .meter .slabel { display: none; }
@media (min-width: 400px) { .mix-card footer .meter .slabel { display: inline-block; } }
.tob-table .meter { flex-wrap: wrap; }

/* ---------- шкала оценок ---------- */
:root { --rl-0: #b5302a; --rl-1: #c48a1c; --rl-2: #4f9a6a; --rl-3: #2f7fbf; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --rl-0: #ff6b5e; --rl-1: #e8bd52; --rl-2: #6cc187; --rl-3: #6fb6f0; } }
:root[data-theme="dark"] { --rl-0: #ff6b5e; --rl-1: #e8bd52; --rl-2: #6cc187; --rl-3: #6fb6f0; }
.rl-0 { --sl-c: var(--rl-0); } .rl-1 { --sl-c: var(--rl-1); } .rl-2 { --sl-c: var(--rl-2); } .rl-3 { --sl-c: var(--rl-3); }
.horns .slabel { margin-left: 4px; }
.facts .horns { flex-wrap: wrap; row-gap: 4px; }
.mix-card header .horns .slabel { font-size: .72rem; padding: 1px 7px; }
.rate-opt.rl-0 span { border-bottom: 3px solid var(--rl-0); } .rate-opt.rl-1 span { border-bottom: 3px solid var(--rl-1); }
.rate-opt.rl-2 span { border-bottom: 3px solid var(--rl-2); } .rate-opt.rl-3 span { border-bottom: 3px solid var(--rl-3); }
.rating-legend { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-2); }
.legends { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
@media (max-width: 640px) { .legends { grid-template-columns: 1fr; } }

/* ---------- фильтры забивок ---------- */
.mix-filters { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.mix-filters > * { flex: none; }
.filters-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters-row input[type=search] { flex: 1 1 240px; }
.filters-row select { flex: 0 1 200px; width: auto; }
.count-pill { background: var(--accent); color: var(--accent-ink); border-radius: 99px; font-size: .75rem; padding: 1px 8px; }
.filter-groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.fgroup { min-width: 0; border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fgroup legend { float: left; width: 90px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding-top: 6px; }
@media (max-width: 600px) { .fgroup legend { float: none; width: 100%; padding: 0 0 2px; } }
.fchip { cursor: pointer; position: relative; }
.fchip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fchip span { display: inline-block; padding: 4px 11px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface-2); font-size: .85rem; font-weight: 650; color: var(--sl-c, var(--ink-2)); }
.fchip span small { color: var(--muted); font-weight: 500; }
.fchip:hover span { border-color: var(--sl-c, var(--ink-2)); }
.fchip input:checked + span { background: var(--sl-c, var(--ink)); border-color: var(--sl-c, var(--ink)); color: var(--surface); }
.fchip input:checked + span small { color: inherit; opacity: .8; }
.fchip input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.result-count { margin: 0 0 10px; }
.filter-panel { position: relative; }
.filter-title { margin: 0; font-weight: 700; color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px;
                cursor: pointer; list-style: none; padding: 6px 10px 6px 0; border-radius: 10px; user-select: none; }
.filter-title::-webkit-details-marker { display: none; }
.filter-title:hover { color: var(--ink); }
.filter-title .chev { width: 26px; height: 26px; padding: 4px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line);
                      transition: transform .2s ease; color: var(--ink-2); }
.filter-panel[open] > .filter-title .chev { transform: rotate(180deg); }
.filter-title:hover .chev { border-color: var(--ink-2); }
.filter-reset { margin-left: 4px; font-weight: 600; }
.filter-panel:not([open]) .filter-groups { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .filter-title .chev { transition: none; } }
.fchip .fb { font-weight: 750; }
.fchip.gone span { text-decoration: line-through; text-decoration-color: var(--bad); opacity: .7; }
.fchip[hidden] { display: none; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.filters input.chip-search { flex: 0 0 180px; width: 180px; padding: 4px 11px; border-radius: 99px; font-size: .85rem; align-self: flex-start; }
/* Телефон: чипы группы — одной строкой с прокруткой, чтобы панель не занимала весь экран */
@media (max-width: 600px) {
  .fgroup { display: block; }
  .fgroup .chip-search { margin-bottom: 6px; }
  .fchips { width: 100%; max-width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
            -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .fchips::-webkit-scrollbar { display: none; }
  .fchip { flex: none; }
  .filters input.chip-search { flex: none; width: 100%; }
}


/* =================================================================
   Мобильная версия
   ================================================================= */
.m-line, .m-unit { display: none; }
.tabbar { display: none; }

@media (max-width: 720px) {
  /* Шапка: одна строка, не прилипает; разделы — в нижней панели */
  .topbar { position: static; flex-wrap: nowrap; padding: 8px 16px; gap: 10px; }
  .topbar .nav { display: none; }
  .brand { font-size: 1.05rem; }
  .brand img { width: 30px; height: 30px; }
  .who { margin-left: auto; gap: 8px; min-width: 0; }
  .role { min-width: 0; }
  .who-name { display: block; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .linkish { padding: 8px 4px; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 52px; justify-content: center;
    font-size: .7rem; font-weight: 650; color: var(--muted); text-decoration: none; border-radius: 12px;
  }
  .tabbar a span { font-size: 1.25rem; line-height: 1.2; filter: grayscale(.6); opacity: .8; }
  .tabbar a.on { color: var(--ink); background: var(--surface-2); }
  .tabbar a.on span { filter: none; opacity: 1; }
  body.has-tabbar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }

  .wrap { padding-top: 14px; }
  h1 { font-size: 1.6rem; }
  .page-head { margin-bottom: 12px; }
  .page-head .actions { width: 100%; }
  .card { padding: 16px; }
  .mix-full, .tob-hero, .rate-card, .comments { padding: 18px 16px; }

  /* Поля: 16px, иначе iPhone приближает страницу при фокусе */
  input, select, textarea, .filters input.chip-search, .tob-filter { font-size: 16px; }
  .btn { min-height: 42px; }
  .btn-sm { min-height: 36px; padding: 6px 12px; }

  /* Крупнее цели для пальца */
  .fchip span { padding: 8px 13px; font-size: .9rem; }
  .tag, button.tag { padding: 6px 12px; font-size: .88rem; }
  .check { width: 30px; height: 30px; }
  .check::before { content: ""; position: absolute; inset: -8px; }
  .seg-control span { padding: 8px 12px; }

  /* Таблицы-карточки */
  .table-wrap.card:has(.m-cards) { background: none; border: 0; box-shadow: none; padding: 0; overflow: visible; }
  .m-cards, .m-cards tbody { display: block; }
  .m-cards thead { display: none; }
  .m-cards tr { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
                margin-bottom: 8px; padding: 10px 12px; gap: 2px 10px; box-shadow: var(--shadow); }
  .m-cards tbody tr:hover { background: var(--surface); }
  .m-cards td { display: block; padding: 0; border: 0; text-align: left; min-width: 0; }
  .m-cards .m-line, .m-cards .m-unit { display: inline; }
  .m-cards .m-line { font-weight: 500; color: var(--muted); }
  .m-cards .num { text-align: left; }

  .tob-row { grid-template-columns: 36px minmax(0, 1fr) auto;
             grid-template-areas: "stock brand act" "stock flavor act" "stock str str" "stock meta meta"; align-items: center; }
  .tob-row .c-stock { grid-area: stock; align-self: start; padding-top: 2px; width: auto; }
  .tob-row .c-brand { grid-area: brand; font-size: .85rem; }
  .tob-row .c-line, .tob-row .desc-col { display: none; }
  .tob-row .c-flavor { grid-area: flavor; font-size: 1.05rem; }
  .tob-row .c-flavor .flavor { display: block; padding: 2px 0; }
  .tob-row .c-str { grid-area: str; margin-top: 4px; }
  .tob-row .c-str:has(.muted) { display: none; }
  .tob-row .c-weight, .tob-row .c-uses { grid-area: meta; font-size: .85rem; color: var(--muted); }
  .tob-row .c-weight { justify-self: start; }
  .tob-row .c-uses { justify-self: end; }
  .tob-row .c-act { grid-area: act; align-self: center; }
  .tob-table .meter { flex-wrap: nowrap; }
  tr.is-out td:not(.stock-col) { opacity: .55; }

  .herd-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name role" "email email" "mixes date" "act act"; align-items: center; }
  .herd-row .c-name { grid-area: name; }
  .herd-row .c-email { grid-area: email; font-size: .88rem; color: var(--ink-2); overflow-wrap: anywhere; }
  .herd-row .c-role { grid-area: role; }
  .herd-row .c-mixes { grid-area: mixes; font-size: .82rem; color: var(--muted); }
  .herd-row .c-date { grid-area: date; font-size: .82rem; color: var(--muted); justify-self: end; }
  .herd-row .c-act { grid-area: act; text-align: left; display: flex; gap: 6px; margin-top: 6px; }
  .herd-row .c-act:empty { display: none; }
  .herd-row .c-act form { margin: 0; }

  /* Форма забивки: табак на всю ширину, процент строкой ниже */
  .item-row { grid-template-columns: 12px minmax(0, 1fr) 40px; grid-template-areas: "dot sel del" ". pct pct"; row-gap: 6px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
  .item-row .dot { grid-area: dot; }
  .item-row select { grid-area: sel; }
  .item-row .pct-input { grid-area: pct; max-width: 160px; }
  .item-row .remove-row { grid-area: del; min-height: 40px; }
  .bowl-tools .pct-sum { width: 100%; margin-left: 0; }
  .row3 { gap: 10px; }

  /* Импорт: справка не распирает страницу */
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .help .table-wrap { overflow-x: auto; }

  .rate-opt span { height: 46px; }
  .mix-grid { grid-template-columns: minmax(0, 1fr); }
  .section-head { margin-top: 26px; }
  .foot { padding-bottom: 14px; }
}

/* ---------- пагинация ---------- */
.pager-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.pager-top p { margin: 0; }
.per-page { margin: 0; }
.per-page label { display: inline-flex; align-items: center; gap: 8px; }
.per-page select { width: auto; padding: 4px 28px 4px 10px; border-radius: 10px; font-size: .9rem; }
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; margin: 22px 0 6px; }
.pg-btn { min-width: 40px; height: 40px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 12px;
          border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; text-decoration: none;
          font-variant-numeric: tabular-nums; }
a.pg-btn:hover { border-color: var(--accent); color: var(--accent); }
.pg-btn.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.pg-btn.disabled { opacity: .35; }
.pg-gap { color: var(--muted); padding: 0 2px; }
@media (max-width: 720px) {
  .per-page select { font-size: 16px; }
  .pg-btn { min-width: 44px; height: 44px; }
}
