﻿:root {
    --mint: #c9eadb;
    --mint-soft: #e8fbef;
    --green: #00965a;
    --green-dark: #007c4a;
    --text: #07120d;
    --muted: #647086;
    --line: #d9dde5;
    --panel: #f1f1f5;
    --danger: #ff4b55;
    --danger-bg: #ffe7e8;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: #fff;
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

.topbar {
    min-height: 78px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    padding: 0 34px;
    background: var(--mint);
}

.brand {
    font-size: 24px;
    font-weight: 800;
}

.main-nav {
    display: flex;
    align-items: stretch;
    gap: 56px;
    height: 78px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-bottom: 3px solid transparent;
    font-size: 22px;
    font-weight: 600;
    transition: color .2s ease, border-color .2s ease;
}

.nav-item.active {
    border-color: var(--green);
    font-weight: 800;
}

.nav-item:hover {
    color: var(--green-dark);
}

.guide-btn {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    height: 42px;
    border-radius: 6px;
    background: var(--green);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    transition: background-color .2s ease;
}

.guide-btn:hover {
    background: var(--green-dark);
}

.top-button {
    position: fixed;
    right: 16px;
    top: 180px;
    z-index: 3;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f0f1f3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
}

.top-button span {
    font-size: 12px;
}

.hero {
    background: linear-gradient(135deg, #e8fbef 0%, #c9eadb 100%);
    text-align: center;
    padding: 50px 30px 58px;
    border-bottom: 1px solid var(--line);
}

.hero-pill {
    display: inline-block;
    padding: 8px 22px;
    border-radius: 999px;
    background: rgba(255,255,255,.55);
    font-style: italic;
    font-weight: 600;
    color: var(--green-dark);
}

.hero h1 {
    margin: 22px auto 12px;
    color: #008b55;
    font-size: 36px;
    line-height: 1.18;
    font-weight: 800;
}

.hero p {
    max-width: 820px;
    margin: 0 auto;
    color: #40504a;
    font-size: 16px;
    line-height: 1.6;
}

.home-section,
.compare-section,
.function-section,
.guide-section {
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
    padding: 40px 0;
}

.database-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 36px;
    max-width: 760px;
    margin: 0 auto 42px;
}

.database-card {
    min-height: 120px;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 14px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.database-card:hover {
    transform: translateY(-3px);
    border-color: var(--green);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
}

.database-card strong {
    color: var(--green-dark);
    font-size: 18px;
    line-height: 1.12;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    background: transparent;
    margin-bottom: 50px;
}

.stats-row div {
    min-height: 126px;
    padding: 22px 20px;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,.05);
}

.stats-row strong {
    display: block;
    margin-bottom: 4px;
    color: #111;
    font-size: 32px;
    font-weight: 800;
}

.stats-row span {
    color: #5f6b66;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.quick-search-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.quick-search-card {
    padding: 28px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fafafa;
    box-shadow: 0 3px 12px rgba(0,0,0,.04);
}

.quick-search-card h2 {
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--green);
    font-size: 20px;
    color: #1d2a22;
}

.quick-search-card p {
    min-height: 68px;
    margin: 0 0 18px;
    color: #5d675f;
    font-size: 14.5px;
    line-height: 1.55;
}

.quick-search-line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.quick-search-line input,
.search-input-wrap input,
.advanced-grid input,
.compact-filters select,
.advanced-grid select {
    width: 100%;
    border: none;
    border-radius: 8px;
    background: #fff;
    min-height: 42px;
    padding: 9px 14px;
    outline: none;
    border: 1px solid #ccd4d0;
}

.quick-search-line button,
.primary-btn {
    border: none;
    border-radius: 6px;
    background: var(--green);
    color: #fff;
    min-height: 42px;
    padding: 0 20px;
    cursor: pointer;
    font-weight: 700;
    transition: background-color .2s ease;
}

.quick-search-line button:hover,
.primary-btn:hover {
    background: var(--green-dark);
}

.compare-section h2,
.function-section h2,
.guide-section h2 {
    text-align: center;
    font-size: 24px;
    margin: 0 0 30px;
    color: #1d2a22;
}

.compare-table,
.result-table {
    width: 100%;
    border-collapse: collapse;
}

.compare-table {
    border: none;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,.05);
}

.compare-table th {
    background: var(--green);
    color: #fff;
    padding: 14px 18px;
    text-align: left;
    font-size: 15px;
    font-weight: 700;
}

.compare-table td {
    min-height: 76px;
    padding: 14px 18px;
    border-top: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    color: #333;
    font-size: 14.5px;
    line-height: 1.55;
}

.compare-table tr:nth-child(even) td {
    background: #fbfdfc;
}

.compare-table td:first-child {
    width: 22%;
    background: #f5f7f6 !important;
    font-weight: 700;
    color: #111;
}

.function-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    padding: 22px;
    border-radius: 8px;
}

.function-tabs input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.function-tabs label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: unset;
    min-height: 34px;
    padding: 0 14px;
    border: 2px solid var(--green-dark);
    background: #fff;
    color: var(--green-dark);
    font-weight: 800;
    cursor: pointer;
    font-size: 13px;
    transition: background-color .2s ease, color .2s ease;
}

.function-tabs label:first-of-type {
    border-radius: 999px 0 0 999px;
}

.function-tabs label:last-of-type {
    border-left: none;
    border-radius: 0 999px 999px 0;
}

#function-cosing:checked + label,
#function-hope:checked + label {
    background: var(--green-dark);
    color: #fff;
}

.function-table-panel {
    display: none;
    grid-column: 1 / -1;
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(0,0,0,.04);
    flex-basis: 100%;
}

#function-cosing:checked ~ .function-table-cosing,
#function-hope:checked ~ .function-table-hope {
    display: block;
}

.function-table-head,
.function-table-panel .function-row {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 18px;
}

.function-table-head {
    padding: 12px 18px;
    background: var(--green);
    color: #fff;
    font-size: 14.5px;
}

.function-table-scroll {
    max-height: 340px;
    overflow-y: auto;
}

.function-table-panel .function-row {
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    color: #333;
    font-size: 14.5px;
    line-height: 1.55;
}

.function-table-panel .function-row:nth-child(even) {
    background: #fbfdfc;
}

.function-row {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 18px;
    padding: 12px 0;
}

.guide-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 28px 70px;
}

.guide-grid strong {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 34px;
    border-radius: 999px;
    background: var(--mint);
}

.search-page {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    min-height: 720px;
    padding: 24px 0 60px;
}

.search-shell {
    margin-bottom: 22px;
}

.search-topline {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f6f8f7;
}

.search-input-wrap {
    position: relative;
    flex: 1;
}

.search-input-wrap input {
    min-height: 46px;
    padding-left: 48px;
    border: 1px solid #ccd4d0;
    background: #fff;
    font-style: normal;
    font-size: 15px;
}

.search-icon-img {
    position: absolute;
    left: 16px;
    top: 50%;
    width: 20px;
    height: 20px;
    opacity: .68;
    transform: translateY(-50%);
}

.secondary-btn,
.reset-btn,
.pdf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    line-height: 1;
    border: none;
    border-radius: 6px;
    background: #d9d9d9;
    color: #111;
    min-height: 40px;
    padding: 0 18px;
    cursor: pointer;
    font-weight: 700;
    transition: background-color .2s ease, color .2s ease;
}

.compact-filters {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px 0 0;
}

.compact-filters select {
    width: 220px;
    min-height: 42px;
    font-size: 14px;
}

.compact-filters .secondary-btn {
    margin-left: auto;
    background: var(--green);
    color: #fff;
    font-size: 14px;
}

.secondary-btn:hover,
.reset-btn:hover {
    background: var(--green-dark);
    color: #fff;
}

.advanced-panel {
    display: none;
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.03);
}

.advanced-panel.open {
    display: block;
}

.advanced-panel h2 {
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    color: #1d2a22;
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.advanced-grid label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #555;
    font-size: 12.5px;
    font-weight: 700;
}

.advanced-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.result-count {
    margin: 18px 0 14px;
    color: var(--muted);
    font-size: 15px;
    font-style: italic;
}

.result-table th {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: #fafafa;
    color: #56615b;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .4px;
    text-transform: uppercase;
    text-align: left;
}

.result-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

.result-table {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.03);
}

.result-table tbody tr:nth-child(even) {
    background: #fbfdfc;
}

.result-table tbody tr:hover {
    background: #f3faf6;
}

.row-title {
    font-weight: 700;
    color: #111;
}

.row-title:hover,
.hope-link:hover,
.relation-pill:hover {
    color: var(--green);
}

.chip,
.score-chip,
.allowed-chip,
.annex-chip,
.more-chip,
.relation-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 3px 10px;
    margin: 3px;
    background: #dff8ec;
    color: #008757;
    font-size: 12px;
    font-weight: 600;
}

.score-chip {
    min-width: 34px;
    justify-content: center;
}

.annex-chip {
    background: var(--danger-bg);
    color: #f3323c;
}

.allowed-chip {
    background: #e4faee;
    color: var(--green);
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

.more-chip {
    background: transparent;
    color: #111;
}

.muted,
.plain-text {
    color: var(--muted);
}

.check-dot {
    display: inline-flex;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: #1479ff;
    color: #fff;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.empty-row {
    text-align: center;
    padding: 40px;
    color: var(--muted);
    font-style: italic;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.pager > span {
    margin-right: auto;
}

.pager a {
    border: 1px solid #ccd2df;
    border-radius: 6px;
    padding: 8px 16px;
    background: #fff;
    color: #333;
    font-weight: 700;
}

.pager a:hover {
    border-color: var(--green);
    color: var(--green-dark);
}

.page-numbers,
.page-jump {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pager .page-number {
    min-width: 38px;
    text-align: center;
    padding-left: 10px;
    padding-right: 10px;
}

.pager .page-number.active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.page-jump-input {
    width: 72px;
    min-height: 38px;
    border: 1px solid #ccd2df;
    border-radius: 6px;
    padding: 0 8px;
}

.page-jump button {
    min-height: 38px;
    border: 1px solid var(--green);
    border-radius: 6px;
    padding: 0 14px;
    background: var(--green);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.page-jump button:hover {
    background: var(--green-dark);
    border-color: var(--green-dark);
}

.detail-page {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 28px;
    padding: 34px 0 56px;
}

.detail-page.single {
    display: block;
    max-width: 980px;
}

.detail-page.single .detail-header {
    grid-template-columns: 1fr;
}

.side-results {
    align-self: start;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.03);
}

.side-results strong,
.side-results a,
.side-results span {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
}

.side-results strong {
    margin-top: 4px;
    color: #111;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.side-results a {
    color: var(--green-dark);
    font-weight: 700;
}

.side-results span {
    color: var(--muted);
}

.side-results a,
.side-results span {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.detail-content {
    min-width: 0;
}

.detail-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: 28px;
    align-items: start;
    margin-bottom: 20px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.03);
}

.detail-header > div {
    min-width: 0;
}

.detail-header h1 {
    margin: 0 0 16px;
    color: #111;
    font-size: 34px;
    font-weight: 800;
    line-height: 1.16;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.chip-row {
    margin-bottom: 20px;
}

.pdf-btn {
    min-height: 40px;
    background: #e1e5e3;
    color: #333;
    font-size: 14px;
    font-weight: 800;
}

.pdf-btn:hover {
    background: #d2d8d5;
}

.structure-box {
    min-height: 210px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9f8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    text-align: center;
    color: var(--muted);
}

.formula-img-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.formula-img-box img {
    display: block;
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
}

.source-caption {
    color: var(--muted);
    font-size: 12px;
    font-style: italic;
}

.detail-section {
    margin-top: 18px;
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.025);
}

.detail-section h2 {
    margin: 0 0 14px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--line);
    color: #1d2a22;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.info-list {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 0 24px;
    margin: 0;
    min-width: 0;
}

.info-list dt {
    padding: 10px 0;
    border-bottom: 1px solid #f2f4f3;
    color: #111;
    font-size: 14px;
    font-weight: 800;
}

.info-list dd {
    min-width: 0;
    padding: 10px 0;
    border-bottom: 1px solid #f2f4f3;
    margin: 0;
    color: #333;
    font-size: 14.5px;
    line-height: 1.6;
    white-space: pre-line;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.detail-section p {
    min-width: 0;
    margin: 0;
    color: #333;
    font-size: 14.5px;
    line-height: 1.65;
    white-space: pre-line;
    overflow-wrap: anywhere;
    word-break: break-word;
}


.reference-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.reference-list li {
    padding: 10px 12px;
    border: 1px solid #f2f4f3;
    border-radius: 6px;
    background: #fbfdfc;
}

.reference-list a,
.reference-list span {
    display: block;
    color: var(--green-dark);
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.5;
    overflow-wrap: anywhere;
    text-decoration: none;
    word-break: break-word;
}

.reference-list a:hover {
    text-decoration: underline;
}

.score-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.score-big {
    display: inline-flex;
    padding: 7px 16px;
    border-radius: 999px;
    background: #dff8ec;
    color: var(--green);
    font-size: 15px;
    font-weight: 800;
}

.relation-pill {
    background: #f0f0f3;
    color: #111;
    font-size: 14px;
    text-decoration: none;
}

.relation-pill:hover {
    background: #e8fbef;
}

.site-footer {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 80px;
    padding: 22px 50px;
    background: linear-gradient(90deg, #c9eadb 0%, #58c992 100%);
    font-size: 18px;
}

.site-footer strong {
    font-size: 22px;
}

@media print {
    .topbar,
    .side-results,
    .top-button,
    .site-footer,
    .pdf-btn {
        display: none;
    }

    .detail-page {
        width: 100%;
        display: block;
        padding: 0;
    }
}

@media (max-width: 900px) {
    .topbar {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 18px;
    }

    .brand,
    .guide-btn {
        justify-self: center;
    }

    .main-nav {
        height: auto;
        gap: 34px;
    }

    .nav-item,
    .brand {
        font-size: 28px;
    }

    .database-cards,
    .quick-search-grid,
    .stats-row,
    .function-columns,
    .guide-grid,
    .search-topline,
    .advanced-grid,
    .detail-page,
    .detail-header,
    .site-footer {
        grid-template-columns: 1fr;
    }

    .function-tabs {
        padding: 16px;
    }

    .function-table-head,
    .function-table-panel .function-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .database-cards {
        gap: 28px;
    }

    .search-page,
    .detail-page {
        width: calc(100% - 24px);
    }

    .compact-filters {
        flex-wrap: wrap;
    }

    .compact-filters .secondary-btn {
        margin-left: 0;
    }

    .result-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .side-results {
        border-right: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
        padding-bottom: 18px;
    }

    .info-list {
        grid-template-columns: 1fr;
    }
}
/* UI restore after pager update */
body .topbar {
    background: #c9eadb !important;
}

body .nav-item.active {
    border-bottom-color: #00965a !important;
    color: #07120d !important;
}

body .guide-btn,
body .primary-btn,
body .compact-filters .secondary-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: #00965a !important;
    color: #fff !important;
}

body .guide-btn:hover,
body .primary-btn:hover,
body .compact-filters .secondary-btn:hover {
    background: #007c4a !important;
    color: #fff !important;
}

body .advanced-actions {
    display: flex !important;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
}

body .advanced-actions .reset-btn,
body .advanced-actions .primary-btn {
    min-width: 112px;
    min-height: 42px;
    flex: 0 0 auto;
}

body .advanced-actions .reset-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #d9d9d9 !important;
    color: #111 !important;
}

body .advanced-actions .reset-btn:hover {
    background: #007c4a !important;
    color: #fff !important;
}

body .allowed-chip {
    background: #e4faee !important;
    color: #00965a !important;
}

body .pager .page-number.active,
body .page-jump button {
    background: #00965a !important;
    border-color: #00965a !important;
    color: #fff !important;
}