:root {
    --bg: #f3f6f4;
    --bg-elev: #ffffff;
    --bg-soft: #e9efec;
    --text: #17211d;
    --text-dim: #5b6a63;
    --border: #d8e2dc;
    --accent: #0f766e;
    --accent-2: #0d9488;
    --accent-soft: #d9f1ed;
    --good: #15803d;
    --good-soft: #dcf5e5;
    --bad: #b91c1c;
    --bad-soft: #fee2e2;
    --warn: #a16207;
    --warn-soft: #fdf3d4;
    --shadow: 0 8px 26px rgba(19, 48, 38, .08);
    --radius: 14px;
    --maxw: 1040px;
}

:root[data-theme="dark"] {
    --bg: #0c1412;
    --bg-elev: #121d1a;
    --bg-soft: #192622;
    --text: #e7f0ec;
    --text-dim: #9aada5;
    --border: #263a34;
    --accent: #2dd4bf;
    --accent-2: #5eead4;
    --accent-soft: #123c36;
    --good: #4ade80;
    --good-soft: #153322;
    --bad: #f87171;
    --bad-soft: #3a1b1b;
    --warn: #fbbf24;
    --warn-soft: #382c12;
    --shadow: 0 10px 30px rgba(0, 0, 0, .38);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0c1412;
        --bg-elev: #121d1a;
        --bg-soft: #192622;
        --text: #e7f0ec;
        --text-dim: #9aada5;
        --border: #263a34;
        --accent: #2dd4bf;
        --accent-2: #5eead4;
        --accent-soft: #123c36;
        --good: #4ade80;
        --good-soft: #153322;
        --bad: #f87171;
        --bad-soft: #3a1b1b;
        --warn: #fbbf24;
        --warn-soft: #382c12;
        --shadow: 0 10px 30px rgba(0, 0, 0, .38);
    }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent-soft) 55%, transparent), transparent 34rem),
        var(--bg);
    color: var(--text);
    font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; }

/* ---------- верхняя панель ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 9px max(16px, calc((100vw - var(--maxw)) / 2));
    background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 750;
    white-space: nowrap;
}
.topbar-title:hover { text-decoration: none; }

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0 9px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: .6px;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 30%, transparent);
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex: 0 1 auto;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
    padding: 6px 11px;
    border-radius: 999px;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
.nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }

.topbar-right { margin-left: auto; }

.icon-btn {
    width: 38px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-soft);
    color: var(--text);
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
}
.icon-btn:hover { border-color: var(--accent); }

.pin-btn { display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 0 10px; }
.pin-btn .pin-star { color: var(--warn); font-size: 15px; line-height: 1; }
.pin-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pin-btn.active .pin-star { color: var(--accent); }
.pin-btn-label { font-size: 13px; font-weight: 650; }
.pin-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 10.5px;
    font-weight: 750;
    line-height: 1;
}
.pin-count.empty { background: var(--bg-soft); color: var(--text-dim); }

main {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.footer {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 18px;
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 18px 16px 26px;
    color: var(--text-dim);
    font-size: 12.5px;
    border-top: 1px solid var(--border);
}

/* ---------- общие блоки ---------- */

.hero { margin: 2px 0 20px; }
.hero h1 { margin: 0 0 6px; font-size: clamp(26px, 4vw, 38px); line-height: 1.12; letter-spacing: -.02em; }
.hero p { max-width: 70ch; margin: 0; color: var(--text-dim); }

.card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin: 0 0 16px;
}
.card h2 { margin: 0 0 10px; font-size: 18px; letter-spacing: -.01em; }

.hint { margin: 8px 0 0; color: var(--text-dim); font-size: 13.5px; }
.hint-inline { color: var(--text-dim); font-size: 12px; }
.muted { color: var(--text-dim); }
.name-en { color: var(--text-dim); font-size: .8em; font-weight: 400; }
.hidden { display: none !important; }

.empty-state { text-align: center; padding: 32px 20px; }
.empty-state h1, .empty-state h2 { margin-bottom: 8px; }

.back-link {
    display: inline-block;
    margin: 0 0 12px;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 600;
}
.back-link:hover { color: var(--accent); }

/* ---------- поиск и категории ---------- */

.searchbar { position: relative; margin: 0 0 12px; }

.searchbar input {
    width: 100%;
    padding: 14px 44px 14px 16px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--bg-elev);
    color: var(--text);
    box-shadow: var(--shadow);
    outline: none;
}
.searchbar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.clear-btn {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 9px;
    background: var(--bg-soft);
    color: var(--text-dim);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.clear-btn:hover { color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 18px; }

.chip {
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-elev);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.chip span { opacity: .65; font-weight: 500; }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.active span { opacity: .85; }

.list-count { margin: 0 0 10px; color: var(--text-dim); font-size: 13.5px; }

.cat-section { margin: 0 0 24px; }
.cat-section > h2 {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0 0 8px;
    font-size: 16px;
    letter-spacing: .01em;
}
.cat-section > h2 span { color: var(--text-dim); font-size: 12.5px; font-weight: 500; }

/* ---------- список веществ ---------- */

.chem-list {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elev);
    box-shadow: var(--shadow);
}

.chem-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.chem-row:last-child { border-bottom: 0; }
.chem-row:hover { background: var(--bg-soft); }
.chem-row-link {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) auto auto 18px;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 10px;
    padding: 11px 4px 11px 14px;
    color: var(--text);
}
.chem-row-link:hover { text-decoration: none; }

.row-pin {
    flex: 0 0 42px;
    border: 0;
    border-left: 1px solid transparent;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
.row-pin:hover, .row-pin.active { color: var(--warn); background: var(--bg-elev); }
.row-pin:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }

.chem-row-names { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.chem-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.chem-row-en { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); font-size: 12.5px; }
.chem-row-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.note-mark { color: var(--warn); font-size: 15px; }
.chev { color: var(--text-dim); font-size: 20px; }

/* ---------- точки цвета ---------- */

.dot {
    display: inline-block;
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--dot, color-mix(in srgb, var(--text-dim) 45%, transparent));
    border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #fff 20%, transparent);
}
.dot-lg { width: 22px; height: 22px; box-shadow: 0 0 0 5px var(--bg-soft); }

/* ---------- бейджи и теги ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1.35;
    white-space: nowrap;
}
.tone-neutral { background: var(--bg-soft); color: var(--text-dim); }
.tone-accent { background: var(--accent-soft); color: var(--accent); }
.tone-good { background: var(--good-soft); color: var(--good); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-bad { background: var(--bad-soft); color: var(--bad); }

.tag {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-soft);
    color: var(--text-dim);
    font-size: 10.5px;
    font-weight: 650;
    vertical-align: 1px;
}
.tag.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }

/* ---------- карточка вещества ---------- */

.chem-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; margin: 0 0 18px; }
.chem-head-text { min-width: 0; flex: 1 1 260px; }
.chem-head h1 { margin: 0; font-size: clamp(27px, 4vw, 40px); line-height: 1.08; letter-spacing: -.02em; }
.chem-en { color: var(--text-dim); font-size: 15px; margin-top: 2px; }
.chem-head-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }

.desc-card p { margin: 0 0 10px; max-width: 78ch; }
.desc-card p:last-child { margin-bottom: 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col > .card { margin-bottom: 16px; }

.props { margin: 0; }
.props > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--border);
}
.props > div:last-child { border-bottom: 0; }
.props dt { color: var(--text-dim); font-size: 13.5px; }
.props dd { margin: 0; text-align: right; font-size: 13.5px; }
.color-value { display: inline-flex; align-items: center; gap: 7px; }
.color-value code { font-size: 12px; color: var(--text-dim); }

.conditions { margin: 0; padding-left: 18px; }
.conditions li { margin: 5px 0; }
.conditions li::marker { color: var(--accent); }

/* ---------- партия ---------- */

.batch-card { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
.card-head h2 { margin: 0; }
.target-field {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-dim);
    font-size: 12.5px;
    white-space: nowrap;
}
.target-field input {
    width: 78px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg);
    color: var(--text);
    text-align: right;
}
.target-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.batch-summary { margin: 0 0 12px; color: var(--text-dim); font-size: 13.5px; }
.batch-summary b { color: var(--text); }

.table-wrap { overflow-x: auto; }
.batch-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.batch-table th {
    padding: 7px 9px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 11.5px;
    font-weight: 650;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.batch-table td { padding: 9px; border-bottom: 1px solid var(--border); }
.batch-table tr:last-child td { border-bottom: 0; }
.batch-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.batch-table tbody tr:hover { background: var(--bg-soft); }

/* ---------- дерево ---------- */

.tree { margin-top: 12px; }

.tree-branch, .tree-leaf { margin: 0; }
.tree-branch > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 8px 7px calc(8px + var(--depth, 0) * 15px);
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
}
.tree-branch > summary::-webkit-details-marker { display: none; }
.tree-branch > summary:hover { background: var(--bg-soft); }
.tree-branch > summary::before {
    content: "▸";
    flex: 0 0 auto;
    width: 12px;
    color: var(--text-dim);
    font-size: 11px;
    transition: transform .15s ease;
}
.tree-branch[open] > summary::before { transform: rotate(90deg); }
.tree-branch > summary .tree-name { flex: 1 1 auto; min-width: 0; }
.tree-leaf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 8px 7px calc(8px + var(--depth, 0) * 15px);
    border-radius: 8px;
}
.tree-leaf:hover { background: var(--bg-soft); }
.tree-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.tree-name a { min-width: 0; overflow-wrap: anywhere; }
.tree-amount {
    flex: 0 0 auto;
    min-width: 54px;
    text-align: right;
    color: var(--text-dim);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.tree-children { margin-left: 6px; border-left: 1px dashed var(--border); padding-left: 2px; }

/* ---------- практические рецепты ---------- */

.practical-detail .badge { margin-left: 4px; vertical-align: 2px; }
.practical-list { margin: 10px 0 0; padding: 0; list-style: none; }
.practical-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 9px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--border);
}
.practical-list li:last-child { border-bottom: 0; }
.practical-amount {
    flex: 0 0 auto;
    min-width: 48px;
    color: var(--accent);
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}
.practical-name { font-weight: 550; }
.practical-notes { margin: 12px 0 0; color: var(--text-dim); font-size: 13.5px; }

.practical-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.practical-card { margin: 0; }
.practical-card header { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 4px; }
.practical-card h3 { margin: 0; font-size: 16px; }
.practical-card header .muted { font-size: 12px; }

/* ---------- использовано в ---------- */

.used-in { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.used-in > span {
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-soft);
    font-size: 13px;
}
.used-in > span a { color: var(--text); }
.used-in > span a:hover { color: var(--accent); }

/* ---------- заметки ---------- */

.notes-card textarea {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    outline: none;
}
.notes-card textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.note-status { margin-top: 6px; color: var(--text-dim); font-size: 12px; }
.note-status.error { color: var(--bad); }

/* ---------- базовые реагенты ---------- */

.base-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }

.base-card {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 1px 9px;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-elev);
    color: var(--text);
    box-shadow: var(--shadow);
}
.base-card:hover { border-color: var(--accent); text-decoration: none; }
.base-card .dot { grid-row: 1 / span 3; align-self: start; margin-top: 5px; }
.base-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.base-en { color: var(--text-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.base-meta { color: var(--text-dim); font-size: 11.5px; }

/* ---------- калькулятор ---------- */

.calc-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.calc-controls label { display: flex; flex-direction: column; gap: 5px; color: var(--text-dim); font-size: 13px; font-weight: 600; }
.calc-controls select,
.calc-controls input {
    min-width: 220px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    outline: none;
}
.calc-controls select:focus,
.calc-controls input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.calc-controls input { min-width: 120px; width: 130px; }

.calc-title { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 4px 0 12px; }
.calc-title h2 { margin: 0; font-size: 22px; }
.calc-title a.badge { text-decoration: none; }

/* ---------- закреплённые ---------- */

.pin-panel {
    position: fixed;
    top: 64px;
    right: max(12px, calc((100vw - var(--maxw)) / 2));
    z-index: 60;
    display: flex;
    flex-direction: column;
    width: min(340px, calc(100vw - 24px));
    max-height: calc(100vh - 80px);
    padding: 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
}
.pin-panel[hidden] { display: none; }
.pin-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pin-panel-head h2 { margin: 0; font-size: 17px; }
.pin-summary { display: block; margin-top: 2px; color: var(--text-dim); font-size: 12px; }
.pin-close {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-soft);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
.pin-close:hover { border-color: var(--accent); color: var(--text); }
.pin-panel-actions { display: flex; gap: 8px; margin: 12px 0 6px; }
.pin-action {
    flex: 1;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-soft);
    color: var(--text);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 650;
}
.pin-action:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pin-action.danger { flex: 0 0 auto; color: var(--bad); }
.pin-action.danger:hover:not(:disabled) { border-color: var(--bad); color: var(--bad); }
.pin-action:disabled { opacity: .45; cursor: default; }

.pin-list { min-height: 0; overflow-y: auto; margin: 4px -4px 0; padding: 0 4px; }
.pin-empty { margin: 8px 0 2px; color: var(--text-dim); font-size: 13.5px; line-height: 1.45; }
.pin-item { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--border); }
.pin-item:first-child { border-top: 0; }
.pin-item-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 8px 2px; color: var(--text); }
.pin-item-link:hover { color: var(--accent); text-decoration: none; }
.pin-item-names { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.pin-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 650; }
.pin-item-en { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); font-size: 11.5px; }
.pin-remove {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
}
.pin-remove:hover { background: var(--bad-soft); color: var(--bad); }

.pin-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-soft);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}
.pin-toggle-btn:hover { border-color: var(--accent); color: var(--text); }
.pin-toggle-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pin-toggle-btn .pin-star { font-size: 15px; line-height: 1; }

/* ---------- адаптив ---------- */

@media (max-width: 780px) {
    .title-text { display: none; }
    .topbar { gap: 8px; }
    .nav a { padding: 6px 9px; }
    .pin-btn-label { display: none; }
    .pin-btn { padding: 0 8px; }
    .two-col { grid-template-columns: 1fr; }
    .chem-row-link { grid-template-columns: 14px minmax(0, 1fr) auto 16px; padding: 10px 4px 10px 12px; }
    .chem-row-badges { display: none; }
    .card { padding: 15px 16px; }
    .props > div { flex-direction: column; gap: 2px; }
    .props dd { text-align: left; }
}

@media (max-width: 520px) {
    main { padding-top: 18px; }
    .nav { gap: 2px; }
    .nav a { padding: 6px 7px; font-size: 13px; }
    .chem-head { gap: 12px; }
    .pin-panel { top: auto; right: 8px; left: 8px; bottom: 8px; width: auto; max-height: 70vh; }
    .pin-toggle-btn { margin-left: 0; }
    .batch-table { font-size: 13px; }
    .batch-table th, .batch-table td { padding: 7px 6px; }
    .tree-name .tag { display: none; }
    .practical-grid { grid-template-columns: 1fr; }
}
