:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #172033;
    --muted: #667085;
    --line: #dfe6ef;
    --primary: #1457d9;
    --primary-dark: #0d3e9f;
    --primary-soft: #e9f0ff;
    --success: #147a53;
    --shadow: 0 16px 44px rgba(23, 32, 51, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(20, 87, 217, .08), transparent 32rem),
        var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }

.page-shell {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 38px 0 28px;
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    padding: 10px 4px;
}

.hero-copy { max-width: 820px; }

.eyebrow {
    display: inline-block;
    color: var(--primary);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

.hero h1 {
    margin: 8px 0 10px;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.02;
    letter-spacing: -.04em;
}

.hero p, .panel-heading p {
    color: var(--muted);
    line-height: 1.65;
}

.hero-badge {
    display: grid;
    place-items: center;
    width: 140px;
    height: 140px;
    border-radius: 34px;
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
    color: white;
    font-weight: 900;
    letter-spacing: .08em;
    box-shadow: var(--shadow);
    transform: rotate(3deg);
}

.panel {
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(223,230,239,.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.search-panel { padding: 24px; margin-bottom: 22px; }

.panel-heading,
.results-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.panel-heading h2,
.results-header h2,
.detail-panel h2 { margin-bottom: 5px; }

.search-main { margin-top: 20px; }

label {
    display: block;
    margin-bottom: 7px;
    font-size: .86rem;
    font-weight: 700;
}

.search-control { display: flex; gap: 10px; }

input, select {
    width: 100%;
    min-height: 46px;
    border: 1px solid #cfd8e6;
    border-radius: 11px;
    background: #fff;
    color: var(--ink);
    padding: 10px 13px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(20, 87, 217, .12);
}

select:disabled { background: #f1f4f8; color: #98a2b3; }

.search-control input { flex: 1; }

.filters-grid {
    display: grid;
    grid-template-columns: 1.3fr 1.3fr 1.3fr .65fr;
    gap: 14px;
    margin-top: 16px;
}

.btn {
    min-height: 44px;
    border: 0;
    border-radius: 11px;
    padding: 10px 17px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s, opacity .15s, background .15s;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: #edf1f6; color: #344054; }
.btn-copy { width: 100%; background: var(--primary); color: white; }

.results-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr);
    gap: 22px;
    align-items: start;
}

.results-panel { padding: 22px; min-width: 0; }
.detail-panel { padding: 24px; position: sticky; top: 18px; }

.result-count {
    flex: none;
    padding: 8px 11px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: .82rem;
    font-weight: 800;
}

.status-box {
    margin-top: 18px;
    padding: 28px;
    border: 1px dashed #cdd6e4;
    border-radius: 14px;
    text-align: center;
    color: var(--muted);
    background: var(--surface-soft);
}

.results-list { margin-top: 16px; }

.result-item {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    width: 100%;
    padding: 16px 14px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.result-item:first-child { border-top: 1px solid var(--line); }
.result-item:hover, .result-item.is-active { background: #f6f9ff; }

.code-pill {
    display: inline-flex;
    justify-content: center;
    padding: 7px 9px;
    border-radius: 9px;
    background: #eef3ff;
    color: #1849a9;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 900;
}

.result-name {
    display: block;
    margin-bottom: 5px;
    font-weight: 800;
    line-height: 1.35;
}

.result-path {
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.45;
}

.result-arrow { color: #98a2b3; font-size: 1.3rem; }

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .9rem;
}

.empty-detail { text-align: center; padding: 42px 10px; color: var(--muted); }
.detail-symbol {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 18px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.6rem;
    font-weight: 900;
}

.detail-code {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 16px 0;
    padding: 14px;
    border-radius: 13px;
    background: #f4f7ff;
}

.detail-code strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.35rem;
    color: var(--primary-dark);
}

.hierarchy { margin: 20px 0; }
.hierarchy-step {
    position: relative;
    padding: 0 0 18px 24px;
}
.hierarchy-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 18px;
    width: 2px;
    height: calc(100% - 4px);
    background: #d8e1ef;
}
.hierarchy-step::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
}
.hierarchy-step small { color: var(--muted); display: block; margin-bottom: 2px; }
.hierarchy-step strong { line-height: 1.4; }

.footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 24px;
    padding: 0 4px;
    color: #7b8798;
    font-size: .8rem;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 50;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: 11px;
    background: #172033;
    color: #fff;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    transition: .2s ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
    .hero-badge { display: none; }
    .filters-grid { grid-template-columns: 1fr 1fr; }
    .results-layout { grid-template-columns: 1fr; }
    .detail-panel { position: static; }
}

@media (max-width: 620px) {
    .page-shell { width: min(100% - 20px, 1440px); padding-top: 22px; }
    .hero h1 { font-size: 2rem; }
    .search-panel, .results-panel, .detail-panel { padding: 17px; }
    .panel-heading { flex-direction: column; }
    .search-control { flex-direction: column; }
    .filters-grid { grid-template-columns: 1fr; }
    .result-item { grid-template-columns: 1fr auto; }
    .code-pill { justify-self: start; }
    .result-copy { grid-column: 1 / -1; }
    .footer { flex-direction: column; }
}
