:root {
  --hsc-blue-thread: #9C27B0;
  --hsc-purple-thread: #5C6BC0;
  --hsc-indigo-thread: #1c84c6;
  --hsc-teal-thread: #009688;
  --hsc-green-thread: #30b035;
  --hsc-gray-border: #E5E7EB;
  --hsc-gray-text: #374151;
  --hsc-gray-muted: #6B7280;
  --hsc-bg-header: #F9FAFB;
}

body.hs-search-page {
  --brand-orange: #ed6c00;
  --brand-orange-hover: #c05500;
  --link-hover-color: #505050;
  --brand-gray: #727171;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border-color: #eeeeee;
  --bg-light: #F8FAFC;
  --radius-lg: 0;
  --radius-md: 0;
  --shadow-sm: 0 0 0 1px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --transition-base: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --section-gap: 16px;
  background-color: var(--bg-light);
  color: var(--text-primary);
}

@media (min-width: 768px) {
  body.hs-search-page {
    --section-gap: 20px;
  }
}

body.hs-search-page .search-result-count {
  margin: 0 0 var(--section-gap);
}

body.hs-search-page .search-result-count__title {
  margin: 0;
  color: var(--text-muted);
  font-size: 20px;
  font-weight: 400;
}

body.hs-search-page .search-result-count__em {
  font-weight: 700;
  color: var(--text-primary);
}

body.hs-search-page .compact-hero {
  background: #fff;
  padding: 24px 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  border-bottom: 1px solid #f5f5f5;
}

body.hs-search-page--hscn .hscn-hero-title {
  border-inline-start: 4px solid var(--brand-orange, #ed6c00) !important;
  line-height: 1.2;
  white-space: nowrap;
}

body.hs-search-page .search-capsule {
  gap: 10px;
  padding: 6px;
  background: #fff;
  border: 1px solid #ddd;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: var(--transition-base);
}

body.hs-search-page .search-capsule button[type="submit"] {
  white-space: nowrap;
  flex: 0 0 auto;
}

body.hs-search-page--hscn .search-capsule {
  border-radius: 0 !important;
}

body.hs-search-page--hscn .search-capsule .btn-search {
  border-radius: 0 !important;
}

body.hs-search-page .search-capsule:focus-within {
  background: #fff !important;
  box-shadow: 0 4px 16px rgba(237, 108, 0, 0.15);
  border-color: var(--brand-orange, #ed6c00) !important;
}

body.hs-search-page .custom-select:focus {
  box-shadow: none;
}

body.hs-search-page .search-capsule input[name="keywords"] {
  flex: 1;
  height: 44px;
  padding-left: 14px;
  font-size: 1.05rem;
}

body.hs-search-page .search-capsule input[name="keywords"]:focus {
  outline: none;
  box-shadow: none;
}

body.hs-search-page .search-capsule .border-start {
  gap: 8px;
}

body.hs-search-page .search-capsule select.form-select {
  width: auto;
  height: 44px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
}

body.hs-search-page .search-capsule select.form-select:hover {
  background-color: #f0f0f0 !important;
}

body.hs-search-page .search-capsule-filters {
  padding: 4px 8px;
}

body.hs-search-page .lock-viewtype-btn {
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

body.hs-search-page .lock-viewtype-btn:hover {
  background-color: #f0f0f0;
}

body.hs-search-page .filter-switch {
  transition: all 0.2s;
  padding: 4px 8px;
  border-radius: 4px;
}

body.hs-search-page .filter-switch:hover {
  background-color: #f8f9fa;
}

body.hs-search-page .filter-switch.active .fa-check-square {
  color: var(--brand-orange, #ed6c00) !important;
}

body.hs-search-page .filter-switch.active span {
  color: #333 !important;
}

.result-container {
  display: flex;
  background: #fff;
  border: 1px solid var(--hsc-gray-border);
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  border-radius: 4px;
  overflow: hidden;
}

.instance-global-controls-card {
  background: #fff;
  border: 1px solid var(--hsc-gray-border);
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  border-radius: 4px;
  overflow: hidden;
}

[id^="instance-card-"].result-container {
  display: block;
}

[id^="instance-card-"] .instance-main-row {
  display: flex;
}

.instance-content {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow-x: auto;
}

[id^="instance-card-"] .instance-debug-line {
  padding: 6px 12px;
  border-top: 1px solid var(--hsc-gray-border);
  text-align: left;
  word-break: break-all;
}

.instance-sidebar {
  background: #fff;
  border-right: 1px solid var(--hsc-gray-border);
  flex-shrink: 0;
}

[id^="instance-card-"] .instance-sidebar {
  width: 120px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

[id^="instance-card-"] .instance-name {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  line-height: 1.4;
}

.thread-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--hsc-gray-border);
  background: var(--hsc-bg-header);
  flex-wrap: wrap;
}

.instance-toolbar-btn {
  font-size: 12px;
}

.thread-controls .control-btn {
  display: inline-flex;
  align-items: center;
}

.control-btn {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #D1D5DB;
  background: #fff;
  color: #374151;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.control-btn:hover { background: #F9FAFB; }
.btn-level-1 { color: var(--hsc-blue-thread); border-color: var(--hsc-blue-thread); }
.btn-level-1:hover { background-color: rgba(156, 39, 176, 0.1); }
.btn-level-2 { color: var(--hsc-purple-thread); border-color: var(--hsc-purple-thread); }
.btn-level-2:hover { background-color: rgba(92, 107, 192, 0.1); }
.btn-level-3 { color: var(--hsc-indigo-thread); border-color: var(--hsc-indigo-thread); }
.btn-level-3:hover { background-color: rgba(28, 132, 198, 0.1); }
.btn-level-4 { color: var(--hsc-teal-thread); border-color: var(--hsc-teal-thread); }
.btn-level-4:hover { background-color: rgba(0, 150, 136, 0.1); }

.instance-viewmode-controls {
  background: transparent !important;
  border-bottom: 0 !important;
  padding: 0 !important;
}

.instance-column-selector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 12px;
  row-gap: 6px;
}

.instance-column-selector label {
  cursor: pointer;
}

.instance-column-selector .form-check-input {
  margin-top: 0;
}

.instance-column-selector #instanceColumnHint {
  flex-basis: 100%;
}

.global-thread-controls {
  overflow: hidden;
  max-height: 260px;
  opacity: 1;
  transform: translateY(0);
  justify-content: flex-start;
}

body.hscn-instance-anim-ready .global-thread-controls {
  transition: max-height 220ms ease, opacity 180ms ease, transform 220ms ease, margin-bottom 220ms ease, padding 220ms ease, border-width 220ms ease;
}

body.hscn-instance-simple-view .global-thread-controls {
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  border-width: 0 !important;
}

body.hscn-instance-simple-view .instance-thread-controls {
  display: none !important;
}

body.hscn-instance-simple-view .instance-quick-nav {
  display: none !important;
}

body.hscn-instance-simple-view .instance-quick-nav-col {
  display: none !important;
}

body.hscn-instance-simple-view #main .col-xl-10 {
  flex: 0 0 100% !important;
  max-width: 100% !important;
}

body.hscn-instance-simple-view .thread-row[data-level="1"],
body.hscn-instance-simple-view .thread-row[data-level="2"],
body.hscn-instance-simple-view .thread-row[data-level="3"],
body.hscn-instance-simple-view .thread-row[data-level="4"] {
  display: none;
}

body.hscn-instance-simple-view .result-container {
  display: none;
}

body.hscn-instance-simple-view .instance-global-controls-card {
  display: none;
}

body.hscn-instance-simple-view .instance-flat-table {
  display: table;
}

body.hscn-instance-simple-view .level-leaf.indent-4 {
  padding-left: 12px;
}

body.hscn-instance-simple-view .level-leaf .desc-text {
  display: none;
}

.instance-flat-table {
  display: none;
}

/* Aggregate view: hide 编码名称 column and its toolbar option */
body:not(.hscn-instance-simple-view) .result-container .thread-table col.col-k-codename {
  width: 0 !important;
  min-width: 0 !important;
}
body:not(.hscn-instance-simple-view) .result-container .thread-table th.col-k-codename,
body:not(.hscn-instance-simple-view) .result-container .thread-table td.col-k-codename {
  display: table-cell !important;
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  border-width: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
}
body:not(.hscn-instance-simple-view) #instanceColumnSelector .instance-col-option-codename {
  display: none !important;
}

/* Detail view (flat) wrapper: horizontal scroll */
.instance-flat-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.instance-flat-table .thread-row td {
  vertical-align: middle;
  padding: 8px 10px;
}

/* 明细视图列宽 */
body.hs-search-page .instance-flat-table col.flat-col-instance { width: 120px; }
body.hs-search-page .instance-flat-table col.flat-col-code { width: 160px; }
body.hs-search-page .instance-flat-table col[class*="col-k-"] { width: auto; }
body.hs-search-page .instance-flat-table col.col-action { width: 80px; }
body.hs-search-page .instance-flat-table col.d-none { width: 0 !important; }
body.hs-search-page .instance-flat-table td.flat-col-instance { min-width: 120px; }
body.hs-search-page .instance-flat-table td.flat-col-code { min-width: 160px; }

.instance-flat-table .thread-row td.flat-col-instance {
  padding: 10px 12px;
  text-align: left;
}

.instance-flat-table .thread-row td.flat-col-code {
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}

.instance-flat-table .thread-row td.flat-col-code .node-link {
  display: inline;
  flex: none;
}

.instance-flat-table .thread-row td.col-action {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
}

.instance-flat-table .thread-row td.flat-col-instance .instance-name {
  font-weight: 600;
  color: #111827;
}

.flat-instance-cell {
  justify-content: flex-start;
  text-align: left;
  padding: 10px 12px;
  line-height: 1.5;
}

.flat-instance-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flat-instance-cell .instance-name {
  font-weight: 600;
  color: #111827;
}

.instance-flat-table tr.instance-debug-row { display: none; }
body.hs-search-page.hscn-instance-debug-on .instance-flat-table tr.instance-debug-row { display: table-row; }

.instance-flat-table tr.instance-debug-row td.instance-debug-cell {
  padding: 0;
  background: #FAFBFC;
  border-bottom: 1px solid var(--hsc-gray-border);
  vertical-align: top;
}

.instance-flat-table tr.instance-debug-row td.instance-debug-cell .instance-debug-line {
  padding: 2px 0;
}

.instance-code-wrap.flat-instance-cell {
  padding: 10px 12px;
}

.flat-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
  padding: 6px 8px;
}

.btn-detail {
  display: inline-block;
  padding: 6px 12px;
  font-size: 12px;
  color: #2563EB;
  border: 1px solid #BFDBFE;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-detail:hover { background: #EFF6FF; }

.btn-copy-code {
  display: inline-block;
  padding: 6px 12px;
  font-size: 12px;
  color: #059669;
  background: #fff;
  border: 1px solid #A7F3D0;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-copy-code:hover {
  background: #ECFDF5;
}

.instance-flat-table .thread-row:hover td.col-action {
  background: #F9FAFB;
}

/* Detail view: codename column */
.instance-flat-table th.col-k-codename {
  text-align: left;
}
.instance-flat-table td.col-k-codename {
  max-width: 220px;
  text-align: left;
  padding-left: 4px;
  min-width: 0;
  overflow: hidden;
}

.instance-codename-text {
  font-size: 13px;
  color: #374151;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.instance-codename-text.expired {
  text-decoration: line-through;
  opacity: 0.6;
}

.simple-view-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #374151;
  user-select: none;
}

.thread-controls .simple-view-label {
  font-size: 12px;
}

.thread-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.thread-table th {
  background: var(--hsc-bg-header);
  color: var(--hsc-gray-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--hsc-gray-border);
  white-space: nowrap;
}

.thread-table th.center,
.thread-table td.center,
.instance-flat-table th.center,
.instance-flat-table td.center { text-align: center; }
.thread-table th.flat-instance-header { padding-left: 8px; }

.col-tree { width: calc(100% - 80px - var(--instance-data-cols-width, 0%)); }
.col-data { width: 10%; }
.col-action { width: 80px; }
.col-unit { width: 6%; }
.col-tax { width: 5%; }
.col-reg { width: 7%; }
.col-insp { width: 7%; }

#code-result-card .col-tree { width: auto; }
#code-result-card .col-unit { width: 70px; }
#code-result-card .col-rate { width: 90px; }
#code-result-card td.col-unit .data-cell-content,
#code-result-card td.col-rate .data-cell-content {
  white-space: nowrap;
}

.thread-table col.d-none,
.instance-flat-table col.d-none {
  width: 0 !important;
  min-width: 0 !important;
  visibility: collapse;
}

.thread-table col.d-none,
.instance-flat-table col.d-none {
  display: table-column !important;
}

.thread-table th.d-none,
.thread-table td.d-none,
.instance-flat-table th.d-none,
.instance-flat-table td.d-none {
  display: table-cell !important;
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  border-width: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
}

.thread-table th.col-action,
.thread-table td.col-action,
.instance-flat-table th.col-action,
.instance-flat-table td.col-action {
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fff;
  box-shadow: -1px 0 0 var(--hsc-gray-border);
}

.thread-table th.col-action,
.instance-flat-table th.col-action {
  z-index: 3;
  background: var(--hsc-bg-header);
  padding-left: 6px;
  padding-right: 6px;
}

.thread-row td {
  padding: 0;
  border-bottom: 1px solid var(--hsc-gray-border);
  vertical-align: middle;
  font-size: 14px;
  color: var(--hsc-gray-text);
  background: #fff;
}

.thread-cell {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  min-height: 42px;
  border-left-width: 4px;
  border-left-style: solid;
  transition: background-color 0.1s, padding-left 180ms ease;
}

.thread-row:hover .thread-cell { background-color: #F9FAFB; }
.level-1 { border-left-color: var(--hsc-blue-thread); background: #F8FAFC; }
.level-2 { border-left-color: var(--hsc-purple-thread); }
.level-3 { border-left-color: var(--hsc-indigo-thread); }
.level-4 { border-left-color: var(--hsc-teal-thread); }
.level-leaf { border-left-color: var(--hsc-green-thread); }
.level-leaf.thread-cell { align-items: flex-start; padding-top: 10px; padding-bottom: 10px; }
.indent-0 { padding-left: 12px; }
.indent-1 { padding-left: 24px; }
.indent-2 { padding-left: 36px; }
.indent-3 { padding-left: 48px; }
.indent-4 { padding-left: 60px; }

.thread-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border: 1px solid #D1D5DB;
  background: #fff;
  border-radius: 2px;
  color: #6B7280;
  font-size: 10px;
  cursor: pointer;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
  margin-top: 3px;
  transition: width 180ms ease, max-width 180ms ease, margin-right 180ms ease, opacity 180ms ease, border-width 180ms ease;
}

.thread-toggle:hover { border-color: #9CA3AF; color: #111827; }
.hidden-toggle { visibility: hidden; }

.code-pill {
  color: #111827;
  margin-right: 8px;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

.code-pill del{
  color: gray;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

.level-leaf .code-pill { color: #2563EB; }
.desc-text {
  color: #374151;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.node-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  flex: 1;
}

.node-link:hover .code-pill { text-decoration: underline; }
.expired { opacity: 0.6; text-decoration: line-through; }

.data-cell-content {
  padding: 8px;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 4px;
}

.instance-code-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.instance-code-cell .node-link { flex: 0 0 auto; }
.instance-code-cell .code-pill { margin-right: 0; }

.instance-code-name-rows {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.instance-code-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 2em;
  padding: 2px 0;
  line-height: 1.5;
}

.instance-code-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.instance-code-candidates .code-pill {
  font-size: 12px;
  color: #2563EB;
}

.tax-text { font-weight: 600; color: #111827; }
.badge-tax {
    font-size: 12px;
    font-weight: 700;
    color: #111827;
}
.badge-char {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  background: #f0f2f5;
  border: 1px solid #d9d9d9;
  border-radius: 3px;
  font-size: 11px;
  color: #555;
  cursor: help;
}

.badge-char:hover { border-color: #1c84c6; color: #1c84c6; background: #fff; }
.btn-detail {
  color: #2563EB;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-detail:hover { background: #EFF6FF; }

.btn-copy {
  font-size: 12px;
  color: #1c84c6;
  cursor: pointer;
  margin-left: 8px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-copy:hover { text-decoration: underline; }

.instance-code-btn.is-selected .code-pill {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .result-container { flex-direction: column; }
  .instance-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--hsc-gray-border); padding: 10px; }
  .col-data { display: none; }
  .thread-cell { padding-right: 12px; }
  .indent-1, .indent-2, .indent-3, .indent-4 { padding-left: 12px; }
}

/* Instance quick nav (Index) */
.instance-quick-nav {
  position: sticky;
  top: 120px;
  max-height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow: hidden;
  margin-top: 12px;
}

.nav-header {
  padding: 8px 0 10px 16px;
  color: #999;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 4px;
}

.nav-body { overflow-y: auto; padding: 0; flex-grow: 1; }

.nav-item-row {
  display: flex;
  align-items: baseline;
  padding: 6px 16px;
  text-decoration: none !important;
  color: #666;
  font-size: 13px;
  line-height: 1.5;
  border-left: 2px solid #e5e5e5;
  transition: all 0.2s;
}

.nav-item-row:hover {
  color: var(--brand-orange, #ed6c00);
  border-left-color: var(--brand-orange, #ed6c00);
  background: rgba(237, 108, 0, 0.05);
}

.nav-index {
  font-size: 11px;
  color: #999;
  min-width: 22px;
  flex-shrink: 0;
}

.nav-text {
  flex: 1;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-scrollbar::-webkit-scrollbar { width: 3px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* Search feedback + triple cards */
.search-feedback-container {
  background-color: #fff !important;
  border-radius: var(--radius-md) !important;
  padding: 12px 20px !important;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color) !important;
  transition: var(--transition-base);
}

.feedback-question {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.feedback-buttons .btn {
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  transition: var(--transition-base);
}

.feedback-btn-yes {
  color: #28a745 !important;
  border-color: #28a745 !important;
}

.feedback-btn-yes:hover {
  background-color: #28a745 !important;
  color: #fff !important;
}

.feedback-btn-no {
  color: #6c757d !important;
  border-color: #6c757d !important;
}

.feedback-btn-no:hover {
  background-color: #6c757d !important;
  color: #fff !important;
}

#search-feedback-detail {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-color);
  overflow: hidden;
}

#search-feedback-detail .card-body {
  background-color: #fff;
}

.hscn-search-triple-card .search-feedback-container {
  background-color: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  border: 0 !important;
}

.hscn-search-triple-card--feedback #search-feedback-host > .alert {
  background-color: transparent !important;
  border: 0 !important;
  padding: 0 !important;
}

.hscn-search-triple-card--feedback #search-feedback-host > .alert.alert-success {
  color: #28a745;
}

.hscn-search-triple-card {
  background-color: #fff;
  border: 1px solid var(--border-color);
  border-radius: 0 !important;
  box-shadow: var(--shadow-sm);
  padding: 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100px;
  transition: var(--transition-base);
}

.hscn-search-triple-card:hover {
  box-shadow: 0 0 0 1px var(--brand-orange), 0 4px 12px rgba(0,0,0,0.05);
}

.hscn-search-triple-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hscn-search-triple-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.hscn-search-triple-card--feedback .hscn-search-triple-body {
  justify-content: center;
}

.hscn-search-triple-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.hscn-feedback-actions,
.hscn-quick-guide-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hscn-feedback-actions .btn,
.hscn-quick-guide-actions .btn {
  width: 100%;
  margin: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  height: 36px;
  white-space: nowrap;
  border-radius: 0 !important;
  border: 1px solid #eee !important;
  background-color: #fcfcfc !important;
  padding: 0 10px !important;
  font-size: 13px;
  transition: all 0.2s;
}

.hscn-feedback-actions .feedback-btn-yes:hover,
.hscn-feedback-actions .feedback-btn-yes:focus-visible,
.hscn-feedback-actions .feedback-btn-yes:active {
  background-color: #28a745 !important;
  border-color: #28a745 !important;
  color: #fff !important;
}

.hscn-feedback-actions .feedback-btn-no:hover,
.hscn-feedback-actions .feedback-btn-no:focus-visible,
.hscn-feedback-actions .feedback-btn-no:active {
  background-color: #6c757d !important;
  border-color: #6c757d !important;
  color: #fff !important;
}

.hscn-quick-guide-actions .btn:hover {
  border-color: var(--brand-orange) !important;
  background-color: #fff !important;
  color: var(--brand-orange) !important;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transform: translateY(-1px);
}

.hscn-quick-guide-actions .btn i {
  width: 16px;
  text-align: center;
}

.hscn-feedback-actions .btn {
  justify-content: center;
}

body.hs-search-page--hscn #searchFeedbackSubmit {
  border-radius: 0 !important;
}

.hscn-search-triple-card--company .hscn-search-triple-body {
  justify-content: center;
}

.hscn-search-triple-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #fafafa;
  border: 1px dashed #ddd;
  padding: 15px;
  color: #999;
}

.hscn-quick-guide-divider {
  width: 100%;
  height: 1px;
  background-color: #eee;
  align-self: center;
  flex: 0 0 auto;
}

.hscn-search-feedback-placeholder .btn[disabled] {
  cursor: not-allowed;
}

.hscn-company-showcase-logo {
  width: 52px;
  height: 52px;
  border-radius: 0;
  border: 1px solid #eee;
  background-color: #fcfcfc;
  overflow: hidden;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-base);
}

.hscn-search-triple-card--company:hover .hscn-company-showcase-logo {
  border-color: var(--brand-orange);
}

.hscn-search-triple-empty i {
  font-size: 24px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.hscn-company-showcase-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hscn-company-showcase-name {
  line-height: 1.2;
}

.hscn-company-showcase-intro,
.hscn-company-showcase-website {
  line-height: 1.2;
  margin-top: 4px;
}

@media (max-width: 575px) {
  .hscn-feedback-actions,
  .hscn-quick-guide-actions {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   海关编码明细视图样式 (Code Detail View)
   ============================================ */

.code-flat-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.code-flat-table {
  display: none;
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.code-flat-table td {
  vertical-align: middle;
}

.code-flat-table th,
.code-flat-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--hsc-gray-border, #e5e7eb);
  font-size: 13px;
}

.code-flat-table thead th {
  background: var(--hsc-bg-header, #f8f9fa);
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.code-flat-table th.text-start,
.code-flat-table td.text-start { text-align: left; }

.code-flat-table th.text-center,
.code-flat-table td.text-center { text-align: center; }

.code-flat-table .data-cell-content.text-center { text-align: center; justify-content: center; }

.code-flat-table td.code-flat-col-code {
  padding: 0 !important;
  vertical-align: middle;
  border-left: 4px solid var(--hsc-green-thread, #22C55E);
}

.code-flat-table .code-cell-inner {
  display: flex;
  align-items: center;
  padding: 8px 12px 8px 8px;
  min-height: 100%;
}

.code-flat-table td.code-flat-col-name {
  text-align: left;
}

body.hs-search-page .code-flat-table col.code-flat-col-code { width: 160px; }
body.hs-search-page .code-flat-table col.code-flat-col-name { width: auto; min-width: 180px; }
body.hs-search-page .code-flat-table col[class*="col-k-"] { width: auto; }
body.hs-search-page .code-flat-table col.col-action { width: 100px; }
body.hs-search-page .code-flat-table col.d-none { width: 0 !important; }

/* Show flat table when code detail view is active */
body.hscn-code-simple-view .code-flat-table {
  display: table;
}

/* Hide aggregate tree when detail view is active */
body.hscn-code-simple-view #code-result-card {
  display: none;
}

/* Hide fold controls when detail view is active */
body.hscn-code-simple-view .code-global-thread-controls {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
}

body.hscn-code-anim-ready .code-global-thread-controls {
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.2s ease;
}

/* ============================================
   Confirmed vs Inferred code distinction
   ============================================ */
tr.code-inferred .thread-cell.level-leaf {
  border-left-color: #ccc;
  border-left-style: dashed;
}

.instance-flat-table tr.code-inferred td.flat-col-code {
  border-left: 3px dashed #ccc;
}

.instance-flat-table tr.code-confirmed td.flat-col-code {
  border-left: 3px solid var(--hsc-green-thread, #30b035);
}

body.hide-inferred-codes tr.code-inferred {
  display: none;
}

.instance-inferred-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--hsc-gray-muted, #6B7280);
  border: 1px solid #D1D5DB;
  border-radius: 50%;
  cursor: help;
  flex-shrink: 0;
}
