/* 補助金・交付金の検索部品専用スタイル（色・角丸・書体は tokens.css から取得） */

#hj-root {
  padding-top: 4px;
  padding-bottom: 8px;
}

.hj-head h1 {
  margin: 0 0 10px;
  font-size: clamp(24px, 3.6vw, 32px);
  line-height: 1.35;
  color: var(--text-strong);
  text-wrap: balance;
}

.hj-lead {
  margin: 0 0 20px;
  max-width: var(--reading);
  color: var(--text-body);
  font-size: 15px;
  line-height: 1.85;
}

.hj-years {
  margin-bottom: 20px;
}

.hj-years .chip {
  min-height: 44px;
  padding: 8px 18px;
  font-size: 14px;
}

.hj-controls {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.hj-q-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hj-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
}

.hj-q {
  flex: none; /* 予算ページの .jsearch の flex-basis が縦並びで高さとして効くのを打ち消す */
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
}

.hj-help {
  margin: 6px 0 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.hj-search-opts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 14px;
}

.hj-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.hj-legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hj-radios,
.hj-checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--text-body);
}

.hj-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-height: 34px;
}

.hj-opt input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand-600);
}

.hj-sep {
  color: var(--border);
}

.hj-sublabel {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
}

.hj-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.hj-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 150px;
  flex: 1 1 160px;
}

.hj-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
}

.hj-field select,
.hj-field input {
  min-height: 44px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-body);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 100%;
  box-sizing: border-box;
}

.hj-field select:focus-visible,
.hj-field input:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 1px;
}

.hj-amt-range {
  flex: 1 1 220px;
}

.hj-range-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hj-range-inputs input {
  min-width: 0;
  flex: 1 1 80px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.hj-range-inputs span {
  color: var(--text-muted);
  font-size: 13px;
}

.hj-reset-wrap {
  flex: 0 0 auto;
  min-width: auto;
}

.hj-btn-sub {
  min-height: 44px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  color: var(--brand-800);
  background: var(--brand-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.hj-btn-sub:hover:not(:disabled) {
  background: var(--brand-200);
}

.hj-btn-sub:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
}

.hj-btn-sub:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.hj-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.hj-summary {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.hj-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hj-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.hj-item summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 44px 14px 18px;
  position: relative;
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.hj-item summary::-webkit-details-marker {
  display: none;
}

.hj-item summary:hover {
  background: var(--brand-050);
}

.hj-item summary:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: -2px;
}

.hj-item summary::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  box-sizing: border-box;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform-origin: 50% 50%;
  transform: rotate(45deg);
  transition: transform .15s ease;
}

.hj-item[open] summary::after {
  transform: rotate(-135deg);
}

.hj-item[open] summary {
  background: var(--brand-050);
  border-bottom: 1px solid var(--border-soft);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.hj-main {
  min-width: 0;
}

.hj-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-strong);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.hj-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-sub);
}

.hj-kubun {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--brand-100);
  color: var(--brand-800);
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.hj-moku {
  color: var(--text-muted);
}

.hj-nums {
  text-align: right;
  white-space: nowrap;
}

.hj-amt {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-800);
  line-height: 1.3;
}

.hj-subnum {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 3px;
}

.hj-diff-up {
  color: var(--result-hold);
}

.hj-diff-down {
  color: var(--result-pass);
}

.hj-diff-none {
  font-family: var(--sans);
  color: var(--text-muted);
}

.hj-dl {
  margin: 0;
  padding: 14px 18px 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 16px;
  font-size: 13px;
  line-height: 1.75;
}

.hj-dl dt {
  font-weight: 700;
  color: var(--text-sub);
  white-space: nowrap;
}

.hj-dl dd {
  margin: 0;
  color: var(--text-body);
  overflow-wrap: anywhere;
}

.hj-mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.hj-more-wrap {
  margin-top: 16px;
  text-align: center;
}

.hj-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
}

.hj-notes {
  margin-top: 36px;
  max-width: none;
}

@media (max-width: 600px) {
  #hj-root {
    padding: 4px 0 8px;
  }

  .hj-controls {
    padding: 14px;
  }

  .hj-opt {
    min-height: 44px;
  }

  .hj-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .hj-field {
    min-width: 0;
    flex: 1 1 auto;
  }

  .hj-item summary {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px 38px 14px 14px;
    align-items: start;
  }

  .hj-item summary::after {
    right: 14px;
    top: 24px;
  }

  .hj-nums {
    text-align: left;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    white-space: normal;
  }

  .hj-dl {
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 12px 14px 14px;
  }

  .hj-dl dt {
    margin-top: 6px;
  }

  .hj-dl dt:first-child {
    margin-top: 0;
  }

  .hj-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .hj-bar .hj-btn-sub {
    width: 100%;
  }
}

/* display 指定が hidden 属性に勝たないように（年度で出し分ける絞り込み） */
#hj-root [hidden] { display: none !important; }
