/* ── 18. History / Inventory ───────────────────────────── */
#hip { background: var(--bg) !important; }
.hi-panel { background: var(--bg) !important; }
html[data-theme="dark"] #hip { background: var(--bg) !important; }
html[data-theme="dark"] .hi-panel { background: var(--bg) !important; }

/* search bar */
.hi-search-wrap input {
  background: var(--bg2) !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
}
.hi-search-wrap input:hover,
.hi-search-wrap input:focus { background: var(--hp) !important; border-color: var(--line) !important; }
html[data-theme="dark"] .hi-search-wrap input { background: var(--bg3) !important; border-color: var(--line) !important; color: var(--ink) !important; }
html[data-theme="dark"] .hi-search-wrap input:focus { background: var(--hp) !important; }

/* filter btn */
.hi-filter-btn {
  background: transparent !important;
  border: 1px solid var(--line) !important;
  color: var(--ink2) !important;
}
.hi-filter-btn:hover { background: var(--hp) !important; color: var(--ink) !important; }
.hi-filter-btn.active {
  background: var(--hp) !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
}
html[data-theme="dark"] .hi-filter-btn { border-color: var(--line) !important; color: var(--ink2) !important; }
html[data-theme="dark"] .hi-filter-btn.active { background: var(--hp) !important; color: var(--ink) !important; }

/* Period chips (今月/先月/etc.) — remove purple border/text */
.hi-chip {
  background: var(--bg) !important;
  border: 1px solid var(--line) !important;
  color: var(--ink2) !important;
}
.hi-chip:hover { background: var(--hp) !important; border-color: var(--line) !important; color: var(--ink) !important; }
.hi-chip.on {
  background: var(--sp) !important;
  border: 1px solid var(--line) !important;
  color: var(--ink) !important;
}
html[data-theme="dark"] .hi-chip { background: var(--bg2) !important; border-color: var(--line) !important; color: var(--ink2) !important; }
html[data-theme="dark"] .hi-chip:hover { background: var(--hp) !important; color: var(--ink) !important; }
html[data-theme="dark"] .hi-chip.on { background: var(--sp) !important; color: var(--ink) !important; border-color: var(--line) !important; }

/* Sort row — count label separate positioning */
.hi-sort-row {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hi-count {
  font-size: 11px;
  color: var(--ink3) !important;
}
.hi-sort {
  background: transparent !important;
  border: none !important;
  color: var(--ink2) !important;
  font-size: 11px;
  font-weight: 700;
}
.hi-sort:hover, .hi-sort:focus { background: transparent !important; border: none !important; }
html[data-theme="dark"] .hi-count { color: var(--ink3) !important; }
html[data-theme="dark"] .hi-sort { color: var(--ink2) !important; background: transparent !important; }

/* History cards */
.hist-card {
  background: var(--bg) !important;
  border: none !important;
  border-bottom: 1px solid var(--line2) !important;
  border-radius: 0 !important;
  margin-bottom: 0 !important;
}
.hist-card:first-child { border-top: 1px solid var(--line2) !important; }
.hist-card-header { background: var(--bg2) !important; border-bottom-color: var(--line2) !important; }
.hist-row { border-bottom-color: var(--line2) !important; }
.hist-row:hover { background: var(--hp) !important; }
.hist-type-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.hist-type-badge--cut {
  background: #e0e7ff;
  color: #4338ca;
}
.hist-type-badge--weight {
  background: #dcfce7;
  color: #166534;
}
.hist-row--weight:hover {
  background: #f0fdf4 !important;
}
.hist-client { color: var(--ink) !important; }
.hist-date { color: var(--ink) !important; }
/* 鋼材種類 → black */
.hist-spec-badge {
  color: var(--ink) !important;
  background: var(--bg2) !important;
  border: none !important;
  font-size: 11px;
  padding: 1px 8px;
}
.hist-desc { color: var(--ink3) !important; }
.hist-rem { color: var(--ink2) !important; }
/* Delete button same style as spec-badge × */
.hist-del-btn {
  background: transparent !important;
  border: none !important;
  color: var(--ink3) !important;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
}
.hist-del-btn:hover { color: var(--rd) !important; background: rgba(220,38,38,.07) !important; }

/* Inventory cards */
.inv-card {
  background: var(--bg) !important;
  border: none !important;
  border-bottom: 1px solid var(--line2) !important;
  border-radius: 0 !important;
  margin-bottom: 0 !important;
}
.inv-card-header { background: var(--bg2) !important; border-bottom-color: var(--line2) !important; }
.inv-spec-label { color: var(--ink) !important; }
.inv-count-badge {
  background: transparent !important;
  border: none !important;
  color: var(--ink3) !important;
  font-size: 11px;
}
.inv-row { border-bottom-color: var(--line2) !important; }
.inv-row:hover { background: var(--hp) !important; }
.inv-len { color: var(--ink) !important; }
.inv-len-unit { color: var(--ink3) !important; }
.inv-note-text { color: var(--ink2) !important; }
.inv-date { color: var(--ink3) !important; }
.inv-qty { background: var(--bg2) !important; border: none !important; color: var(--ink2) !important; }
/* inv delete btn - same as hist */
.inv-del-btn {
  background: transparent !important;
  border: none !important;
  color: var(--ink3) !important;
  padding: 3px 8px !important;
  border-radius: 4px !important;
}
.inv-del-btn:hover { color: var(--rd) !important; background: rgba(220,38,38,.07) !important; }

/* Manual add form */
.hi-add-btn {
  background: transparent !important;
  border: 1px dashed var(--line) !important;
  color: var(--ink2) !important;
}
.hi-add-btn:hover { background: var(--hp) !important; border-color: var(--line) !important; }
.hi-add-form-inner { background: var(--bg) !important; border-color: var(--line) !important; }
.hi-submit-btn {
  background: var(--bg) !important;
  border: 1px solid var(--line) !important;
  color: var(--ink) !important;
}
.hi-submit-btn:hover { background: var(--hp) !important; }

html[data-theme="dark"] .hist-card { background: var(--bg2) !important; border-bottom-color: var(--line) !important; }
html[data-theme="dark"] .hist-card-header { background: var(--bg3) !important; border-bottom-color: var(--line) !important; }
html[data-theme="dark"] .hist-row { border-bottom-color: var(--line) !important; }
html[data-theme="dark"] .hist-row:hover { background: var(--hp) !important; }
html[data-theme="dark"] .hist-type-badge--cut {
  background: rgba(79, 70, 229, 0.22) !important;
  color: #a5b4fc !important;
}
html[data-theme="dark"] .hist-type-badge--weight {
  background: rgba(22, 101, 52, 0.28) !important;
  color: #86efac !important;
}
html[data-theme="dark"] .hist-row--weight:hover { background: rgba(34, 197, 94, 0.12) !important; }

/* 表示切替ボタン */
.hi-view-btn {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink3);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.hi-view-btn--on {
  background: var(--bk);
  color: #fff;
  border-color: var(--bk);
}

/* 案件グループ */
.hist-job-group {
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 8px;
  overflow: hidden;
}
.hist-job-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg2);
  cursor: pointer;
  user-select: none;
}
.hist-job-hd:hover { background: var(--bg3); }
.hist-job-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.hist-job-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--ink3);
  margin-top: 2px;
  flex-wrap: wrap;
}
.hist-job-arrow {
  font-size: 16px;
  color: var(--ink3);
  transition: transform .2s;
  margin-left: auto;
}
.hist-job-group.open .hist-job-arrow { transform: rotate(90deg); }
.hist-job-body { display: none; }
.hist-job-group.open .hist-job-body { display: block; }
html[data-theme="dark"] .hist-client { color: var(--ink) !important; }
html[data-theme="dark"] .hist-spec-badge { color: var(--ink) !important; background: var(--bg3) !important; }
html[data-theme="dark"] .hist-del-btn { color: var(--ink3) !important; }
html[data-theme="dark"] .hist-del-btn:hover { color: var(--rd) !important; background: rgba(220,38,38,.1) !important; }
html[data-theme="dark"] .inv-card { background: var(--bg2) !important; border-bottom-color: var(--line) !important; }
html[data-theme="dark"] .inv-card-header { background: var(--bg3) !important; border-bottom-color: var(--line) !important; }
html[data-theme="dark"] .inv-spec-label { color: var(--ink) !important; }
html[data-theme="dark"] .inv-row { border-bottom-color: var(--line) !important; }
html[data-theme="dark"] .inv-row:hover { background: var(--hp) !important; }
html[data-theme="dark"] .inv-del-btn { color: var(--ink3) !important; }
html[data-theme="dark"] .inv-del-btn:hover { color: var(--rd) !important; background: rgba(220,38,38,.1) !important; }
html[data-theme="dark"] .hi-add-btn { border-color: var(--line) !important; color: var(--ink2) !important; }
html[data-theme="dark"] .hi-add-btn:hover { background: var(--hp) !important; }
html[data-theme="dark"] .hi-add-form-inner { background: var(--bg2) !important; border-color: var(--line) !important; }
html[data-theme="dark"] .hi-submit-btn { background: var(--bg2) !important; border-color: var(--line) !important; color: var(--ink) !important; }

/* ── 19. hi-card (history card alternate) ───────────────────── */
.hi-card { border: none !important; border-bottom: 1px solid var(--line2) !important; border-radius: 0 !important; }
.hi-card:hover { background: var(--hp) !important; border-bottom-color: var(--line2) !important; }
.hi-card-client { color: var(--ink) !important; }
.hi-tag { background: var(--bg2) !important; color: var(--ink2) !important; }
.hi-tag-kind { background: var(--bg3) !important; color: var(--ink) !important; }
html[data-theme="dark"] .hi-card { border-bottom-color: var(--line) !important; background: transparent !important; }
html[data-theme="dark"] .hi-card:hover { background: var(--hp) !important; }
html[data-theme="dark"] .hi-card-client { color: var(--ink) !important; }
html[data-theme="dark"] .hi-tag { background: var(--bg3) !important; color: var(--ink2) !important; }
html[data-theme="dark"] .hi-tag-kind { background: var(--bg3) !important; color: var(--ink) !important; }

/* remnant pills */
.rem-pill { background: var(--bg) !important; border: 1px solid var(--line) !important; color: var(--ink) !important; }
.rem-pill-empty { color: var(--ink3) !important; }
html[data-theme="dark"] .rem-pill { background: var(--bg2) !important; border-color: var(--line) !important; color: var(--ink) !important; }

/* rem-pill-item: inline remnant length chips in calc results */
.rem-pill-item {
  display: inline-block;
  font-size: 11px;
  background: var(--bg3) !important;
  color: var(--ink) !important;
  padding: 2px 7px;
  border-radius: 4px;
  margin: 2px;
}
html[data-theme="dark"] .rem-pill-item {
  background: var(--bg2) !important;
  color: var(--ink) !important;
}

/* inv-card-new (dropdown) */
.inv-card-new { background: var(--bg) !important; border: none !important; border-bottom: 1px solid var(--line2) !important; border-radius: 0 !important; }
.inv-card-new:hover { background: var(--hp) !important; border-color: var(--line2) !important; }
html[data-theme="dark"] .inv-card-new { background: var(--bg2) !important; border-bottom-color: var(--line) !important; }
html[data-theme="dark"] .inv-card-new:hover { background: var(--hp) !important; }
