/* ── TaxRoutine HSN/SAC Browser ─────────────────────────────────────── */
#trhsn-app {
  font-family: 'Segoe UI', system-ui, sans-serif;
  max-width: 900px;
  margin: 0 auto;
  color: #1a2332;
  --blue:   #1a56db;
  --blue-l: #e8f0fe;
  --green:  #047857;
  --border: #e2e8f0;
  --bg:     #f8fafc;
  --radius: 8px;
}

/* Tabs */
.trhsn-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.trhsn-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: #64748b;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.trhsn-tab:hover { color: var(--blue); }
.trhsn-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}
.trhsn-badge {
  font-size: 10px;
  background: var(--blue-l);
  color: var(--blue);
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
}

/* Search bar */
.trhsn-search-bar {
  display: flex;
  align-items: center;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  margin-bottom: 16px;
  transition: border-color .2s;
}
.trhsn-search-bar:focus-within { border-color: var(--blue); }
.trhsn-search-icon { font-size: 16px; margin-right: 8px; opacity:.6; }
#trhsn-search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 0;
  font-size: 15px;
  background: transparent;
  color: #1a2332;
}
#trhsn-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #94a3b8;
  padding: 4px;
  display: none;
}
#trhsn-search-clear:hover { color: #e53e3e; }

/* Breadcrumb */
.trhsn-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
}
.trhsn-bc-item {
  color: var(--blue);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 4px;
  transition: background .15s;
}
.trhsn-bc-item:hover { background: var(--blue-l); }
.trhsn-bc-item.active { color: #475569; cursor: default; font-weight: 600; }
.trhsn-bc-sep { color: #cbd5e1; }

/* List wrap */
.trhsn-list-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

/* Row */
.trhsn-row {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
  cursor: pointer;
}
.trhsn-row:last-child { border-bottom: none; }
.trhsn-row:hover { background: var(--bg); }
.trhsn-row.non-drill { cursor: default; }

.trhsn-code {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-l);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: .5px;
}
.trhsn-code.sac { color: var(--green); background: #d1fae5; }

.trhsn-desc {
  font-size: 14px;
  line-height: 1.4;
  color: #1e293b;
}
.trhsn-desc small {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 1px;
}

.trhsn-arrow { color: #cbd5e1; font-size: 16px; }
.trhsn-row.non-drill .trhsn-arrow { display: none; }

/* Level labels */
.trhsn-row[data-level="chapter"]    .trhsn-code { background: #eff6ff; color: #1d4ed8; }
.trhsn-row[data-level="heading"]    .trhsn-code { background: #f0fdf4; color: #15803d; }
.trhsn-row[data-level="subheading"] .trhsn-code { background: #fefce8; color: #a16207; }
.trhsn-row[data-level="tariff"]     .trhsn-code { background: #fff7ed; color: #c2410c; }

/* Loading / empty */
.trhsn-loading, .trhsn-empty {
  padding: 40px;
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
}
.trhsn-loading::before { content: '⏳ '; }
.trhsn-empty::before   { content: '🔎 '; }

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

/* Search result header */
.trhsn-results-header {
  padding: 10px 16px;
  font-size: 12px;
  color: #64748b;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Utility */
.hidden { display: none !important; }

@media (max-width: 600px) {
  .trhsn-row { grid-template-columns: 100px 1fr auto; gap: 8px; padding: 10px 12px; }
  .trhsn-desc { font-size: 13px; }
  .trhsn-tabs { gap: 4px; }
  .trhsn-tab { padding: 8px 14px; font-size: 14px; }
}
