* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #ffffff;
    --ink: #111111;
    --muted: #555555;
    --soft: #777777;
    --line: #d8d8d8;
    --line-strong: #bcbcbc;
    --panel: #fafafa;
    --empty: #f6f6f6;
    --link: #000000;
    --focus: #000000;
    --assistant-panel-width: 396px;
    --assistant-panel-gap: 0px;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--link);
    text-decoration: underline;
}

a:hover {
    color: var(--muted);
}

.container {
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto;
}

.page-shell {
    width: 100%;
    min-height: 100vh;
}

header {
    position: relative;
    padding: 24px 0 20px;
    border-bottom: 1px solid #f0f0f0;
    background: #111;
    color: #fff;
    z-index: 0;
}

header::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -100vw;
    right: 0;
    background: #111;
    z-index: -1;
}

header h1 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 10px;
}

.header-logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}

.flag-icon {
    height: 30px;
    width: auto;
    filter: grayscale(100%);
}

.poster-section {
    margin-top: 32px;
    text-align: center;
}

.poster-image-large {
    max-width: 100%;
    height: auto;
    max-height: 400px;
}

.search-section {
    padding: 20px 0 24px;
}

.filters select:focus,
.filters button:focus,
.view-btn:focus,
#suggestBtn:focus {
    outline: none;
}

.filters,
.view-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filters select,
.filters button,
.view-btn,
#suggestBtn {
    padding: 10px 14px;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.filters select {
    min-width: 170px;
}

.filters button {
    padding: 10px 16px;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.view-btn.active,
.filters button,
#suggestBtn {
    background: var(--ink);
    color: #fff;
}

.results-info {
    font-size: 13px;
    color: var(--muted);
}

.directory-grid {
    padding: 24px 0 40px;
}

.no-results {
    padding: 8px 9px;
    margin-bottom: 12px;
    border: 1px solid #f0f0f0;
    background: #fff;
    font-size: 11px;
}

.section-board {
    padding: 24px 0 28px;
    border-top: 1px solid #f0f0f0;
}

.section-board:first-of-type {
    border-top: 0;
}

.section-board-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.section-board-header h2 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 22px;
    line-height: 1.3;
    font-weight: 700;
}

.section-board-total {
    font-size: 12px;
    color: var(--soft);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.subcategory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px 32px;
}

.section-content-area {
    margin-top: 24px;
    padding: 20px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    transition: opacity 0.2s ease;
}

.manufacturer-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.section-content-area .manufacturer-list {
    display: table-row-group;
    margin: 0;
    padding: 0;
    list-style: none;
}

.manufacturer-table-header {
    display: table-header-group;
    font-size: 11px;
    color: var(--soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.manufacturer-table-header span {
    display: table-cell;
    padding: 0 16px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: bottom;
}

.section-content-area .manufacturer-item {
    display: table-row;
}

.section-content-area .manufacturer-item:nth-child(even) {
    background: #fafafa;
}

.section-content-area .manufacturer-item:hover {
    background: #f0f0f0;
}

.section-content-area .manufacturer-line {
    display: table-cell;
    padding: 12px 16px;
    vertical-align: top;
    width: 22%;
}

.manufacturer-name {
    font-weight: 700;
    font-size: 15px;
    display: block;
}

.manufacturer-location {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.section-content-area .manufacturer-description {
    display: table-cell;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
    width: 39%;
}

.section-content-area .manufacturer-products {
    display: table-cell;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
    width: 18%;
}

.section-content-area .manufacturer-links {
    display: table-cell;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    width: 21%;
}

.subcategory-card {
    min-width: 0;
}

.subcategory-card.has-data {
    cursor: pointer;
}

.subcategory-card.has-data .subcategory-summary::before {
    content: "[+]";
    width: 26px;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--soft);
}

.subcategory-card.active .subcategory-summary::before {
    content: "[-]";
}

.subcategory-card.has-data:hover .subcategory-summary {
    background: #f5f5f5;
    border-radius: 4px;
}

.subcategory-card.active .subcategory-summary {
    background: #e3f2fd;
    border-radius: 4px;
}

.subcategory-summary {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.subcategory-card.is-empty:hover .subcategory-summary {
    background: #f5f5f5;
    border-radius: 4px;
}

.subcategory-name {
    font-size: 14px;
    font-weight: 700;
}

.subcategory-badge {
    font-size: 12px;
    color: var(--soft);
}

.subcategory-card.is-empty {
    color: var(--soft);
}

.subcategory-empty-note {
    margin-left: 36px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--soft);
}

.assistant-panel {
    display: none;
}

.assistant-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 26px 18px 22px;
}

.assistant-panel-body.is-landing {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.assistant-panel-body.is-landing .assistant-messages {
    flex: 0 0 auto;
}

.assistant-panel-body.is-landing .assistant-quick-links,
.assistant-panel-body.is-landing .fun-fact-trigger,
.assistant-panel-body.is-landing .fun-fact-card {
    flex: 0 0 auto;
}

.assistant-panel-body.is-landing .assistant-results {
    display: none;
}

.assistant-quick-links,
.fun-fact-trigger,
.fun-fact-card {
    text-align: center;
    opacity: 1;
    overflow: hidden;
    transition: opacity 0.28s ease, max-height 0.35s ease, margin 0.35s ease, padding 0.35s ease;
}

.assistant-quick-links {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 10px;
    margin: 16px 0 8px;
    max-height: 420px;
}

.assistant-quick-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}

.assistant-quick-link.is-primary {
    color: #5f4a20;
}

.fun-fact-card {
    max-height: 300px;
    margin: 10px 0 0;
    padding: 18px 20px;
    background: #fffdf8;
    border: 1px solid #ece3d4;
    border-radius: 14px;
}

.assistant-quick-links.is-hidden,
.fun-fact-trigger.is-hidden,
.fun-fact-card.is-hidden {
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

.fun-fact-kicker {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8b8179;
}

.fun-fact-text {
    margin-top: 8px;
    font-size: 15px;
    line-height: 1.45;
    color: #1e1b18;
}

.assistant-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    width: fit-content;
    max-width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
}

.chat-message.bot {
    background: #ffffff;
    border: 1px solid #ececec;
}

.chat-message.bot p + p {
    margin-top: 10px;
}

.chat-message.user {
    margin-left: auto;
    background: #111;
    color: #fff;
}

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

.assistant-results-list {
    display: grid;
    gap: 10px;
}

.assistant-result-card {
    padding: 12px;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 8px;
}

.assistant-result-card h3 {
    font-size: 13px;
    line-height: 1.3;
}

.assistant-result-card p {
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

.assistant-result-card a {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
}

.assistant-input {
    padding: 14px 18px 18px;
    border-top: 1px solid #ededed;
    background: #fff;
}

.assistant-input textarea {
    width: 100%;
    resize: vertical;
    min-height: 96px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font: inherit;
    line-height: 1.5;
}

.assistant-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.assistant-hint {
    font-size: 12px;
    color: var(--muted);
}

.assistant-input button {
    padding: 10px 14px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.assistant-input button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.subcategory-content {
    margin-top: 12px;
    margin-left: 36px;
}

.manufacturer-list {
    list-style: none;
}

.manufacturer-item {
    padding: 0 0 12px;
    margin-bottom: 12px;
    border-bottom: 1px dotted var(--line);
}

.manufacturer-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.manufacturer-line {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.manufacturer-name {
    font-size: 14px;
    font-weight: 700;
    text-decoration: underline;
}

span.manufacturer-name {
    text-decoration: none;
}

.manufacturer-meta,
.manufacturer-description,
.manufacturer-products,
.manufacturer-links {
    font-size: 13px;
    color: var(--muted);
}

.manufacturer-description,
.manufacturer-products,
.manufacturer-links {
    margin-top: 6px;
}

.manufacturer-products strong {
    color: var(--ink);
    font-weight: 700;
}

.graph-container {
    position: relative;
    padding: 24px 0 40px;
}

#networkGraph {
    width: 100%;
    height: 760px;
    border: 1px solid #f0f0f0;
    background: #fff;
}

#networkGraph .leaflet-container {
    font-family: Arial, Helvetica, sans-serif;
}

.map-legend {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    max-width: 280px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.map-legend h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.legend-caption {
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--muted);
}

.legend-reset,
.legend-item {
    width: 100%;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.legend-reset {
    margin-bottom: 10px;
    padding: 8px 10px;
    font-size: 12px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 8px 10px;
}

.legend-reset:hover,
.legend-item:hover {
    border-color: #bdbdbd;
    background: #fafafa;
}

.legend-reset.is-active,
.legend-item.is-active {
    border-color: #111;
    background: #f3f3f3;
    box-shadow: inset 0 0 0 1px #111;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

@media (max-width: 720px) {
    .page-shell {
        width: 100%;
    }

    .assistant-panel {
        position: static;
        width: auto;
        height: auto;
        border-left: 0;
        border-top: 1px solid #ededed;
        box-shadow: none;
    }

    .container {
        width: min(1180px, calc(100% - 24px));
    }

    .map-legend {
        top: auto;
        right: 8px;
        bottom: 8px;
        left: 8px;
        max-width: none;
        max-height: 180px;
    }
}

.view-controls {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.unmapped-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.unmapped-header h2 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 20px;
    line-height: 1.3;
}

.unmapped-header p,
.unmapped-header .section-board-total {
    font-size: 13px;
    color: var(--muted);
}

.add-manufacturer {
    padding: 16px 0 32px;
}

.add-manufacturer p {
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--muted);
}

footer {
    padding: 20px 0 24px;
    border-top: 1px solid var(--ink);
    font-size: 12px;
    color: var(--soft);
}

@media (max-width: 900px) {
    .subcategory-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(100% - 16px, 1180px);
    }

    header h1 {
        font-size: 26px;
    }

    .section-board-header h2,
    .unmapped-header h2 {
        font-size: 18px;
    }

    .filters,
    .view-controls,
    .manufacturer-line {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .filters select,
    .filters button,
    .view-btn,
    #suggestBtn {
        width: 100%;
    }

    #networkGraph {
        height: 620px;
    }
}
