/* =====================================================
   IBISWorld Data Navigator - Data Dictionary Styles
   ===================================================== */

/* Dictionary Content Wrapper */
.dict-content {
    max-width: 1400px;
    margin: 0 auto;
}

/* Dictionary filter panel: flex row with export pushed right */
.filter-panel {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Filter Grid */
.dict-filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    flex: 1;
}

.dict-filter-grid .filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dict-filter-grid .search-box {
    min-width: 220px;
    padding: 8px 12px;
    font-size: 0.85rem;
}

.dict-filter-grid select {
    padding: 8px 12px;
    font-size: 0.85rem;
    min-width: 140px;
}

.dict-filter-grid .btn {
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* Content Tabs */
.dict-tabs {
    display: flex;
    gap: 2px;
    margin-left: auto;
    background: var(--background-color);
    border-radius: 6px;
    overflow: hidden;
    width: fit-content;
    align-self: center;
}

.dict-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.dict-tab:hover {
    background: #f0f0f0;
    color: var(--text-color);
}

.dict-tab.active {
    background: var(--primary-color);
    color: white;
}

/* Tab Panels */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Results Count */
.results-count {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 10px;
    font-weight: 500;
}

/* Table Wrapper */
.table-wrapper {
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* Dictionary Table */
.dict-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.dict-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-light);
    background: var(--background-color);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.dict-table th:nth-child(1) { width: 16%; }  /* Data Attribute */
.dict-table th:nth-child(2) { width: 14%; }  /* Section */
.dict-table th:nth-child(3) { width: 10%; }  /* Data Type */
.dict-table th:nth-child(4) { width: 48%; }  /* Definition */
.dict-table th:nth-child(5) { width: 12%; }  /* Availability */

.dict-table th:hover {
    background: #e9ecef;
}

.dict-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.dict-table tr:hover {
    background: #f8f9fa;
}

.dict-table td.def-cell {
    line-height: 1.5;
    color: var(--text-light);
    overflow-wrap: break-word;
}

.dict-table td.section-name {
    font-weight: 600;
    color: var(--text-color);
}

.dict-table td.api-param {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.75rem;
    color: var(--accent-purple);
}

/* Product Line Badge */
.product-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

.product-badge.industry { background: #e8f0fe; color: var(--primary-color); }
.product-badge.bed { background: #fff7ed; color: var(--accent-orange); }
.product-badge.company { background: #f0fdf4; color: #166534; }
.product-badge.procurement { background: #fdf2f8; color: #9d174d; }
.product-badge.enterprise-profiles { background: #ecfdf5; color: #065f46; }
.product-badge.economic-profile { background: #e0f2fe; color: #0369a1; }
.product-badge.supplieriq { background: #f3e8ff; color: #6b21a8; }
.product-badge.classifications { background: #fef3c7; color: #92400e; }

/* Data Type Badge */
.type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

.type-badge.analysis { background: #ede9fe; color: var(--accent-purple); }
.type-badge.categorical { background: #fce7f3; color: #9d174d; }
.type-badge.mixed { background: #fef9c3; color: #854d0e; }
.type-badge.quantitative { background: #e0f2fe; color: #0369a1; }
.type-badge.reference { background: #d1fae5; color: #065f46; }
.type-badge.text { background: #f1f5f9; color: #475569; }

/* Availability Badges */
.avail-badges {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.avail-row {
    display: flex;
    gap: 4px;
}

.avail-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
}

.avail-badge.available {
    background: var(--accent-green);
    color: white;
}

.avail-badge.unavailable {
    background: #f0f0f0;
    color: #ccc;
}

.avail-badge.coming-soon {
    background: #fef3c7;
    color: #b45309;
}

/* Category Badge */
.category-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    background: #f0f0f0;
    color: var(--text-light);
    white-space: nowrap;
}

.category-badge.category-risk {
    background: #FEF0C7;
    color: #B54708;
}

.category-badge.category-esg {
    background: #D1FADF;
    color: #067647;
}

/* Muted placeholder */
.text-muted {
    color: #ccc;
}

/* Inline Aliases */
.field-aliases {
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
    margin-left: 0.5rem;
}

.section-aliases {
    font-size: 0.8rem;
    color: var(--text-light);
    font-style: italic;
}

/* Inline Levels */
.field-levels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* When levels appear at the top of a section body, remove top margin, add bottom */
.detail-section-body > .field-levels:first-child {
    margin-top: 0;
    margin-bottom: 10px;
}

.field-level {
    display: flex;
    gap: 6px;
    align-items: baseline;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 4px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.field-level strong {
    color: var(--text-color);
    font-weight: 600;
}

.field-level span {
    color: var(--text-light);
}

/* Use Cases Styles */
.usecases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.usecase-card {
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.usecase-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.usecase-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.usecase-header p {
    font-size: 0.8rem;
    opacity: 0.9;
    line-height: 1.5;
}

.usecase-body {
    padding: 16px 20px;
}

.usecase-products {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.usecase-sections-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.usecase-section-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.usecase-section-link {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    background: #f0f0f0;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    border: 1px solid transparent;
}

.usecase-section-link:hover {
    background: #e8f0fe;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Product Group Headers (top-level) */
.product-group-header td {
    background: var(--primary-color);
    padding: 10px 12px;
    font-weight: 600;
    font-size: 0.8rem;
    border-bottom: none;
    border-top: none;
}

.product-group-header .product-group-name {
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-group-header .group-count {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    margin-left: 8px;
}

.dict-table tr.product-group-header:hover {
    background: var(--primary-color);
}

/* Product Group info icon */
.group-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    font-size: 9px;
    font-weight: bold;
    font-style: italic;
    opacity: 0.6;
    transition: opacity 0.2s;
    cursor: help;
    margin-left: 6px;
    vertical-align: middle;
}

.product-group-header:hover .group-info-icon {
    opacity: 1;
    background: rgba(255, 255, 255, 0.5);
}

/* Product Type Group Headers */
.product-type-header td {
    background: white;
    padding: 8px 12px 8px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    border-left: 4px solid #e53e3e;
}

.product-type-header .product-badge {
    font-size: 0.75rem;
    background: none;
    color: #334155;
    padding: 0;
}

.product-type-header .group-count {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 400;
    margin-left: 8px;
}

.dict-table tr.product-type-header:hover {
    background: white;
}

/* Product Type info icon */
.type-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    background: #BDBDBD;
    color: white;
    border-radius: 50%;
    font-size: 8px;
    font-weight: bold;
    font-style: italic;
    opacity: 0.5;
    transition: opacity 0.2s;
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
}

.product-type-header:hover .type-info-icon {
    opacity: 1;
    background: var(--secondary-color);
}

/* Expandable Section Rows */
.dict-table tr.expandable {
    cursor: pointer;
}

.dict-table tr.expandable:hover {
    background: #f0f4ff;
}

.section-name-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.expand-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-light);
    flex-shrink: 0;
}

.field-count {
    font-size: 0.65rem;
    color: var(--text-light);
    font-weight: 400;
    margin-left: 4px;
}

/* Detail Panel */
.detail-panel-row:hover {
    background: transparent;
}

.detail-panel-row td {
    padding: 0 !important;
    border-bottom: 2px solid var(--border-color);
}

.detail-panel {
    background: #f8faff;
    padding: 16px 20px;
    border-top: 1px solid #e0e7ff;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Detail Section — consistent block for each panel area */
.detail-section {
    padding: 0 0 14px 0;
    border-bottom: 1px solid #e0e7ff;
}

.detail-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.detail-section-count {
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    margin-left: 4px;
}

.detail-section-body {
    /* Container for section content */
}


/* Country Availability (section-level) */
.country-availability {
    /* Spacing handled by parent .detail-section */
}

/* Region-grouped country rows */
.country-region-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
}

.country-region-row + .country-region-row {
    border-top: 1px solid #eef2f7;
}

.country-region-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-light);
    min-width: 110px;
    flex-shrink: 0;
    padding-top: 5px;
}

.country-region-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.country-avail-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.73rem;
    font-weight: 500;
    background: #e8f0fe;
    color: var(--primary-color);
    white-space: nowrap;
}

.country-avail-badge .fi {
    font-size: 0.8rem;
}

.country-avail-toggle {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.73rem;
    font-weight: 500;
    background: #f0f0f0;
    color: var(--text-light);
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: background 0.15s;
}

.country-avail-toggle:hover {
    background: #e0e0e0;
    color: var(--text-color);
}

/* Core market badge highlight */
.country-avail-badge.core-market {
    background: #d6e4f9;
    font-weight: 600;
}

/* Note icon on country badge */
.country-note-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--secondary-color);
    color: white;
    font-size: 0.55rem;
    font-weight: 700;
    font-style: italic;
    cursor: help;
    margin-left: 3px;
    flex-shrink: 0;
}

/* String-type country notes banner */
.country-note-banner {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 4px;
    font-size: 0.73rem;
    line-height: 1.5;
    color: #92400e;
}

/* Field Groups */
.detail-groups {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.detail-group-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--primary-color);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e0e7ff;
}

.detail-group-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 8px;
}

/* Individual Field Card */
.detail-field {
    background: white;
    border-radius: 6px;
    padding: 10px 12px;
    border: 1px solid #e9ecef;
    font-size: 0.75rem;
}

.detail-field-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.detail-field .field-formula {
    margin-bottom: 4px;
}

.detail-field-def {
    color: var(--text-light);
    line-height: 1.5;
    font-size: 0.73rem;
}

.field-name {
    font-weight: 500;
    color: var(--primary-color);
    white-space: nowrap;
}

.field-formula {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.7rem;
    color: var(--accent-purple);
    background: #f5f3ff;
    padding: 2px 6px;
    border-radius: 3px;
}

.field-unit {
    font-size: 0.65rem;
    color: var(--text-light);
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

.field-group-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 500;
    background: #e8f0fe;
    color: var(--primary-color);
    white-space: nowrap;
}

.field-country-badges {
    display: inline-flex;
    gap: 2px;
    margin-left: 6px;
    vertical-align: middle;
}

.field-country-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 3px;
    border-radius: 2px;
}

.field-country-badge .fi {
    margin-right: 0 !important;
    font-size: 0.7rem;
}

/* Row-based field layout */
.detail-rows {
    display: flex;
    flex-direction: column;
}

.detail-row {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    font-size: 0.75rem;
}

.detail-row:last-child {
    border-bottom: none;
}



.detail-row-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.detail-row-def {
    color: var(--text-light);
    line-height: 1.5;
    font-size: 0.73rem;
}

/* Components table (Risk Score sub-components) */
.components-list {
    margin-top: 6px;
}

.components-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
}

.components-table th {
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    padding: 4px 8px;
    border-bottom: 1px solid #ddd;
}

.components-table td {
    padding: 3px 8px;
    color: var(--text-light);
    border-bottom: 1px solid #f0f0f0;
}

.components-table tr:last-child td {
    border-bottom: none;
}

.components-note {
    font-style: italic;
    margin-top: 4px;
}

/* Country notes banner (Financial Ratios) */
.country-notes-banner {
    background: var(--gray-50, #f9fafb);
    border: 1px solid #e9ecef;
    border-radius: var(--radius-sm, 4px);
    padding: 8px 12px;
    margin-bottom: 8px;
}

.country-notes-banner .note-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 0.73rem;
    color: var(--text-light);
    line-height: 1.6;
}

.country-notes-banner .note-row strong {
    color: var(--text-color);
    flex-shrink: 0;
}

/* Filter Toggle (hidden on desktop, shown on mobile) */
.filter-toggle {
    display: none;
}

/* On desktop, drawer is transparent — children flow inline in the flex grid */
.filter-drawer {
    display: contents;
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--secondary-color);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: 4px;
    padding: 0 5px;
}

.filter-count:empty {
    display: none;
}

/* Export dropdown — base styles in shared.css; dictionary-specific overrides */
.export-dropdown {
    align-self: flex-end;
    margin-left: auto;
}

/* Toast styles are in shared.css */

/* Search Highlight */
mark {
    background: #fef08a;
    color: inherit;
    padding: 1px 2px;
    border-radius: 2px;
}

/* Empty State styles are in shared.css */


/* API Schema Panel */
.api-schema {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.api-detail-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.api-detail-label {
    min-width: 80px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    flex-shrink: 0;
}

.api-detail-value {
    font-size: 0.8rem;
}

.api-parameter {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-color);
    background: #f0f0f0;
    padding: 3px 8px;
    border-radius: 4px;
}

.api-response-badge {
    font-size: 0.65rem;
    color: var(--text-light);
    background: #f0f0f0;
    padding: 2px 7px;
    border-radius: 4px;
}

a.api-docs-link {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.15s;
}

a.api-docs-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

@media (max-width: 600px) {
    .api-detail-row {
        flex-direction: column;
        gap: 2px;
    }

    .api-detail-label {
        min-width: unset;
    }
}

/* Responsive */
@media (max-width: 768px) {
    /* Allow horizontal scroll as safety net (breaks sticky on desktop) */
    .table-wrapper {
        overflow-x: auto;
    }

    /* --- Collapsible Filter Drawer --- */
    .dict-filter-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: flex-end;
    }

    .dict-filter-grid > .filter-group:first-child {
        flex: 1;
        min-width: 0;
    }

    .dict-filter-grid .search-box {
        width: 100%;
        min-width: unset;
    }

    .filter-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .filter-drawer {
        display: none;
        flex-direction: column;
        gap: 10px;
        width: 100%;
        padding-top: 10px;
        border-top: 1px solid var(--border-color);
        margin-top: 4px;
    }

    .filter-drawer.open {
        display: flex;
    }

    .filter-drawer .filter-group {
        width: 100%;
    }

    .filter-drawer select,
    .filter-drawer .btn {
        width: 100%;
        min-width: unset;
    }

    /* Hide export on tablet/mobile */
    .export-dropdown {
        display: none;
    }

    .dict-table {
        font-size: 0.75rem;
    }

    /* Hide Section and Data Type columns */
    .dict-table th:nth-child(2),
    .dict-table td:nth-child(2),
    .dict-table th:nth-child(3),
    .dict-table td:nth-child(3) {
        display: none;
    }

    /* Redistribute column widths across 3 remaining columns */
    .dict-table th:nth-child(1) { width: 22%; }
    .dict-table th:nth-child(4) { width: 60%; }
    .dict-table th:nth-child(5) { width: 18%; }

    /* Allow header text to wrap */
    .dict-table th {
        white-space: normal;
    }

    /* Hide field count — not enough room in narrow columns */
    .field-count {
        display: none;
    }

    /* Increase touch targets */
    .dict-table td {
        padding: 12px 10px;
    }

    .usecases-grid {
        grid-template-columns: 1fr;
    }

    .field-levels {
        flex-direction: column;
    }

    .detail-group-fields {
        grid-template-columns: 1fr;
    }

    .country-region-row {
        flex-direction: column;
        gap: 4px;
    }

    .country-region-label {
        min-width: unset;
    }

    .country-region-badges {
        gap: 4px;
    }

}

@media (max-width: 480px) {
    .dict-tab {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    /* --- Table-to-Card Transformation --- */

    /* Hide table header */
    .dict-table thead {
        display: none;
    }

    /* Make tbody a flex column of cards */
    .dict-table tbody {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }

    /* Reset table-layout so cards aren't constrained */
    .dict-table {
        table-layout: auto;
    }

    /* Group header rows — full-width banners */
    .dict-table tr.product-group-header {
        display: block;
        border-radius: 6px;
        overflow: hidden;
    }

    .dict-table tr.product-type-header {
        display: block;
        border-radius: 6px;
        overflow: hidden;
    }

    /* Data rows — card styling */
    .dict-table tr.expandable,
    .dict-table tbody tr:not(.product-group-header):not(.product-type-header):not(.detail-panel-row) {
        display: block;
        background: white;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        padding: 12px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    .dict-table tr.expandable:hover,
    .dict-table tbody tr:not(.product-group-header):not(.product-type-header):not(.detail-panel-row):hover {
        background: #f8faff;
    }

    /* All td cells — block-level, stacked vertically */
    .dict-table td {
        display: block;
        width: 100% !important;
        padding: 2px 0;
        border-bottom: none;
    }

    /* Column 1 — Data Attribute: card title */
    .dict-table td:nth-child(1) {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-color);
        padding-bottom: 6px;
    }

    .section-name-wrap {
        min-width: 0;
    }

    .section-name-wrap mark,
    .section-name-wrap > :not(.expand-chevron):not(.field-count) {
        overflow-wrap: break-word;
        word-break: break-word;
        min-width: 0;
    }

    /* Column 2 — Section: inline badge next to Data Type */
    .dict-table td:nth-child(2) {
        display: inline-block;
        width: auto !important;
        font-size: 0.7rem;
        color: var(--text-light);
        padding-right: 8px;
    }

    /* Column 3 — Data Type: inline next to Section */
    .dict-table td:nth-child(3) {
        display: inline-block;
        width: auto !important;
    }

    /* Column 4 — Definition: full width, clamped to 3 lines */
    .dict-table td:nth-child(4) {
        padding-top: 8px;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.5;
        color: var(--text-light);
        font-size: 0.75rem;
    }

    /* Show full definition when row is expanded */
    .dict-table tr.expanded td:nth-child(4) {
        -webkit-line-clamp: unset;
        overflow: visible;
    }

    /* Column 5 — Availability: bottom of card with separator */
    .dict-table td:nth-child(5) {
        padding-top: 8px;
        margin-top: 8px;
        border-top: 1px solid #f0f0f0;
    }

    /* Slightly larger availability badges for touch */
    .dict-table td:nth-child(5) .avail-badge {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }

    /* Group header cells — full width in banner rows */
    .product-group-header td,
    .product-type-header td {
        display: block;
        width: 100% !important;
    }

    .product-group-header td {
        padding: 10px 12px;
    }

    .product-type-header td {
        padding: 8px 12px;
    }

    /* --- Detail Panel Cards --- */
    .dict-table tr.detail-panel-row {
        display: block;
        margin-top: -8px;
        border: 1px solid #e9ecef;
        border-top: none;
        border-radius: 0 0 8px 8px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    /* Connect expanded card to its detail panel */
    .dict-table tr.expandable.expanded {
        border-radius: 8px 8px 0 0;
        margin-bottom: 0;
    }

    .detail-panel-row td {
        display: block;
        width: 100% !important;
    }

    .detail-panel {
        padding: 12px;
        gap: 10px;
    }

    .detail-section {
        padding: 0 0 10px 0;
    }

    /* Stack detail row headers vertically */
    .detail-row-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* Larger expand chevron for touch */
    .expand-chevron {
        width: 24px;
        height: 24px;
        font-size: 1.1rem;
    }

    /* --- Export Dropdown → Bottom Sheet --- */
    .export-dropdown {
        position: static;
    }

    .export-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        border-radius: 12px 12px 0 0;
        margin-top: 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    }

    .export-menu-item {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 0.85rem;
    }

    .export-menu-item:first-child {
        border-radius: 12px 12px 0 0;
    }

    .export-menu-item:last-child {
        border-radius: 0;
        padding-bottom: 20px; /* safe area for bottom of viewport */
    }

    /* --- Tooltip position fix for cards --- */
    .avail-badge[data-tooltip]::after {
        left: auto;
        right: 0;
        transform: none;
    }
}