.hscode-page {
    padding: 24px 32px;
    max-width: 1200px;
    margin: 0 auto;
    font-family: system-ui, -apple-system, sans-serif;
}

.hscode-page-header {
    margin-bottom: 20px;
}

.hscode-page-header h2 {
    margin: 0 0 4px 0;
    color: #24292e;
}

.hscode-page-subtitle {
    color: #586069;
    margin: 0;
    font-size: 0.95em;
}

/* ─── Sub-tabs ──────────────────────────────────────────────────── */

.hscode-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e1e4e8;
    margin-bottom: 20px;
}

.hscode-tab {
    background: transparent;
    border: none;
    padding: 10px 18px;
    font-size: 0.95em;
    font-weight: 500;
    color: #586069;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s ease;
}

.hscode-tab:hover {
    color: #24292e;
    background: rgba(3, 102, 214, 0.04);
}

.hscode-tab.active {
    color: #0366d6;
    border-bottom-color: #0366d6;
    font-weight: 600;
}

.hscode-tab-content {
    padding-top: 4px;
}

.hscode-section {
    background: #ffffff;
    padding: 0;
}

.hscode-section-hint {
    color: #586069;
    font-size: 0.95em;
    line-height: 1.9;
    margin-bottom: 20px;
}

.hscode-section-hint code {
    display: inline-block;
    background: #eaf3ff;
    color: #0366d6;
    padding: 4px 12px;
    margin: 2px 4px 2px 0;
    border-radius: 14px;
    font-size: 0.85em;
    font-weight: 600;
    font-family: system-ui, -apple-system, sans-serif;
    border: 1px solid #c6e0ff;
    transition: all 0.15s ease;
}

.hscode-section-hint code:hover {
    background: #0366d6;
    color: #ffffff;
    border-color: #0366d6;
    cursor: default;
    transform: translateY(-1px);
}

/* ─── Selected banner ───────────────────────────────────────────── */

.hscode-selected-banner {
    margin-top: 20px;
    padding: 14px 18px;
    background: #e6f7e6;
    border-radius: 6px;
    border-left: 4px solid #28a745;
    font-size: 0.95em;
}

.hscode-selected-banner code {
    background: #ffffff;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 600;
}

/* ─── Records table ─────────────────────────────────────────────── */

.hscode-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    overflow: hidden;
}

.hscode-table thead {
    background: #f6f8fa;
}

.hscode-table th {
    text-align: left;
    padding: 12px 14px;
    font-weight: 600;
    color: #24292e;
    font-size: 0.85em;
    border-bottom: 1px solid #e1e4e8;
}

.hscode-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f0f3f5;
    font-size: 0.9em;
}

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

.hscode-table tr:hover {
    background: #f9fafb;
}

.hscode-table code {
    background: #f6f8fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #24292e;
}

.hscode-keywords-cell {
    max-width: 280px;
    color: #586069;
    font-size: 0.85em;
    line-height: 1.4;
}

.hscode-badge {
    background: #e1e4e8;
    color: #24292e;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 500;
}

.hscode-status-active {
    background: #e6f7e6;
    color: #1a7a1a;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 600;
}

.hscode-status-inactive {
    background: #ffe9ec;
    color: #b31d28;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 600;
}

/* ─── Statistics grid ───────────────────────────────────────────── */

.hscode-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .hscode-stats-grid {
        grid-template-columns: 1fr;
    }
}

.hscode-stat-card {
    background: #f6f8fa;
    padding: 14px 18px;
    border-radius: 6px;
    border: 1px solid #e1e4e8;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80px;
}

.hscode-stat-label {
    font-size: 0.8em;
    color: #586069;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.hscode-stat-value {
    font-size: 1.3em;
    font-weight: 600;
    color: #24292e;
}

/* ─── Browse Records: filter controls ─────────────────────── */

.hscode-browse-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.hscode-filter-input {
    flex: 1;
    min-width: 280px;
    padding: 10px 14px;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease;
}

.hscode-filter-input:focus {
    border-color: #0366d6;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.15);
}

.hscode-browse-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e6f7e6;
    color: #1a7a1a;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid #b8e6b8;
}

.hscode-browse-counter::before {
    content: "📊";
    font-size: 1em;
}

/* ─── Recent Searches ─────────────────────────────────────── */

.hscode-recent {
    margin-top: 24px;
    padding: 16px 18px;
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
}

.hscode-recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #586069;
    font-weight: 600;
}

.hscode-recent-clear {
    background: transparent;
    border: none;
    color: #0366d6;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background 0.15s ease;
}

.hscode-recent-clear:hover {
    background: rgba(3, 102, 214, 0.08);
}

.hscode-recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hscode-recent-chip {
    background: #ffffff;
    border: 1px solid #d1d5da;
    color: #24292e;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.15s ease;
}

.hscode-recent-chip:hover {
    background: #0366d6;
    border-color: #0366d6;
    color: #ffffff;
    transform: translateY(-1px);
}

/* ─── Chapter distribution card ───────────────────────────── */

.hscode-chapter-card {
    margin-top: 24px;
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 18px 20px;
}

.hscode-chapter-card h4 {
    margin: 0 0 14px 0;
    color: #24292e;
    font-size: 1em;
}

.hscode-chapter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.hscode-chapter-row {
    display: grid;
    grid-template-columns: 120px 1fr 56px;
    align-items: center;
    gap: 10px;
    font-size: 0.85em;
    color: #24292e;
}

.hscode-chapter-label {
    font-weight: 600;
    color: #586069;
}

.hscode-chapter-bar-wrap {
    background: #f6f8fa;
    border-radius: 3px;
    overflow: hidden;
    height: 8px;
}

.hscode-chapter-bar {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #0366d6 0%, #28a745 100%);
    transition: width 0.4s ease;
}

.hscode-chapter-count {
    text-align: right;
    font-weight: 600;
    color: #24292e;
}
