/* ==========================================================================
   SEDORI COCKPIT — UI部品のスタイル
   --------------------------------------------------------------------------
   ・色は tokens.css の変数だけを使う（直書き禁止）。半透明は rgb(var(--x-rgb) / a)。
   ・実物と使い方は #/_kit（部品ギャラリー）で確認できる。
   ・目次:
     01 ボタン        02 入力・セレクト   03 トグル/チェック/ラジオ  04 タブ・セグメント
     05 バッジ        06 カード           07 KPI・ゲージ・メーター    08 進捗・スピナー・スケルトン
     09 テーブル      10 カンバン         11 モーダル・ドロワー        12 トースト
     13 ツールチップ・メニュー・コマンドパレット    14 空状態・エラー状態  15 注意書きボックス
     16 フォーム      17 ステッパー・タイムライン・チェックリスト     18 チャート・ファネル
     19 サムネイル・その他
   ========================================================================== */

/* ==========================================================================
   01 ボタン
   .btn + .btn--primary | --secondary | --ghost | --danger | --soft | --danger-soft
   サイズ: .btn--sm | (既定) | .btn--lg   形: .btn--icon | .btn--block
   状態: :disabled / [aria-disabled="true"] / .is-loading
   ========================================================================== */
.btn {
  --btn-h: var(--control-h-md);
  --btn-px: var(--sp-4);
  --btn-fg: var(--text-1);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: var(--btn-h);
  min-width: var(--btn-h);
  padding: 0 var(--btn-px);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background-color: transparent;
  color: var(--btn-fg);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out),
    transform var(--dur-2) var(--ease-out),
    opacity var(--dur-2) var(--ease-out);
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

.btn svg {
  width: 1.15em;
  height: 1.15em;
  pointer-events: none;
}

/* 主ボタン: シアン〜ブルーのグラデーション＋発光 */
.btn--primary {
  --btn-fg: var(--text-on-accent);
  background-image: var(--accent-grad);
  box-shadow: var(--glow-accent);
}
.btn--primary:hover {
  background-image: var(--accent-grad-hover);
  box-shadow: var(--glow-accent-strong);
  transform: translateY(-1px);
}

/* 副ボタン: 面＋罫線 */
.btn--secondary {
  background-color: var(--surface-2);
  border-color: var(--line-2);
  box-shadow: inset 0 1px 0 var(--highlight);
}
.btn--secondary:hover {
  background-color: var(--surface-3);
  border-color: var(--line-3);
  transform: translateY(-1px);
}

/* ゴースト: 文字だけ。表の行内や補助操作に */
.btn--ghost {
  --btn-fg: var(--text-2);
}
.btn--ghost:hover {
  --btn-fg: var(--text-1);
  background-color: var(--neutral-soft);
}

/* ソフト: アクセントの淡い面。主ボタンの次に強い操作に */
.btn--soft {
  --btn-fg: var(--accent-fg);
  background-color: var(--accent-soft);
  border-color: var(--accent-line);
}
.btn--soft:hover {
  background-color: var(--accent-soft-2);
  transform: translateY(-1px);
}

/* 危険: 削除など取り消せない操作 */
.btn--danger {
  --btn-fg: var(--text-on-danger);
  background-image: var(--danger-grad);
  box-shadow: var(--glow-danger);
}
.btn--danger:hover {
  background-image: var(--danger-grad-hover);
  transform: translateY(-1px);
}

.btn--danger-soft {
  --btn-fg: var(--danger-fg);
  background-color: var(--danger-soft);
  border-color: var(--danger-line);
}
.btn--danger-soft:hover {
  background-color: rgb(var(--danger-rgb) / 0.24);
  transform: translateY(-1px);
}

/* サイズ */
.btn--sm {
  --btn-h: var(--control-h-sm);
  --btn-px: var(--sp-3);
  font-size: var(--fs-sm);
  gap: var(--sp-1-5);
  border-radius: var(--r-md);
}
/* 見た目は32pxのまま、当たり判定を36pxに広げる */
.btn--sm::before {
  content: "";
  position: absolute;
  inset: -2px 0;
}
.btn--lg {
  --btn-h: var(--control-h-lg);
  --btn-px: var(--sp-6);
  font-size: var(--fs-lg);
  border-radius: var(--r-lg);
}

/* アイコンだけの正方形ボタン（aria-label 必須） */
.btn--icon {
  padding: 0;
  width: var(--btn-h);
}
.btn--icon svg {
  width: 1.3em;
  height: 1.3em;
}
.btn--block {
  display: flex;
  width: 100%;
}

/* 無効 */
.btn:disabled,
.btn[aria-disabled="true"],
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  filter: saturate(0.6);
  pointer-events: none;
}

/* 読み込み中: 文字を隠して中央にスピナー */
.btn.is-loading {
  color: transparent;
  pointer-events: none;
}
.btn.is-loading > * {
  visibility: hidden;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.15em;
  height: 1.15em;
  margin: -0.575em 0 0 -0.575em;
  border-radius: 50%;
  border: 2px solid var(--btn-fg);
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}

/* 文字リンク風のボタン */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: var(--hit-min);
  padding: 0 var(--sp-1);
  color: var(--accent-fg);
  font-weight: var(--fw-medium);
  border-radius: var(--r-sm);
  text-decoration: none;
}
.link-btn:hover {
  text-decoration: underline;
}
.link-btn svg {
  width: 1.05em;
  height: 1.05em;
}

/* ==========================================================================
   02 入力・セレクト・テキストエリア
   .input / .select / .textarea   サイズ: .input--sm | .input--lg   数値: .input--num
   前後に単位や記号: .input-group > .input-group__affix + .input
   状態: :disabled / [readonly] / .is-invalid / [aria-invalid="true"]
   ========================================================================== */
.input,
.select,
.textarea {
  display: block;
  width: 100%;
  height: var(--control-h-md);
  padding: 0 var(--sp-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-control);
  background-color: var(--surface-sunken);
  color: var(--text-1);
  font-size: var(--fs-md);
  line-height: 1.4;
  transition:
    border-color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out),
    background-color var(--dur-2) var(--ease-out);
  appearance: none;
  -webkit-appearance: none;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-4);
  opacity: 1;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--line-3);
}

.input:focus,
.select:focus,
.textarea:focus,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-2);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input[readonly],
.textarea[readonly] {
  background-color: transparent;
  border-style: dashed;
  color: var(--text-2);
}

.input.is-invalid,
.select.is-invalid,
.textarea.is-invalid,
.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.input--sm,
.select--sm {
  height: var(--hit-min);
  font-size: var(--fs-sm);
  padding: 0 var(--sp-2-5);
}
.input--lg,
.select--lg {
  height: var(--control-h-lg);
  font-size: var(--fs-lg);
  padding: 0 var(--sp-4);
}

/* 金額・数量: 右寄せの等幅数字 */
.input--num {
  text-align: right;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}
.input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.select {
  padding-right: calc(var(--sp-3) + 22px);
  background-image: var(--icon-chevron-down);
  background-repeat: no-repeat;
  background-position: right var(--sp-2-5) center;
  background-size: 16px 16px;
  cursor: pointer;
  text-overflow: ellipsis;
}
.select option {
  background-color: var(--surface-solid);
  color: var(--text-1);
}

.textarea {
  height: auto;
  min-height: 96px;
  padding: var(--sp-2-5) var(--sp-3);
  line-height: var(--lh-body);
  resize: vertical;
}

/* 単位・記号・アイコン付きの入力 */
.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: var(--control-h-md);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-control);
  background-color: var(--surface-sunken);
  transition:
    border-color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out);
  min-width: 0;
}
.input-group:hover {
  border-color: var(--line-3);
}
.input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-2);
}
.input-group.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.input-group > .input,
.input-group > .select {
  flex: 1 1 auto;
  min-width: 0;
  height: auto;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
}
.input-group > .input:focus,
.input-group > .select:focus {
  box-shadow: none;
}
.input-group__affix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--sp-3);
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-family: var(--font-num);
  white-space: nowrap;
  flex-shrink: 0;
}
.input-group__affix:first-child {
  padding-right: 0;
}
.input-group__affix:last-child {
  padding-left: 0;
}
.input-group__affix svg {
  width: 16px;
  height: 16px;
}
.input-group--sm {
  height: var(--hit-min);
}
.input-group--lg {
  height: var(--control-h-lg);
}
.input-group--lg > .input {
  font-size: var(--fs-lg);
}

/* ==========================================================================
   03 トグル / チェック / ラジオ
   <label class="toggle"><input type="checkbox" role="switch"><span class="toggle__track"></span><span class="toggle__label">…</span></label>
   <label class="check"><input type="checkbox"><span class="check__box"></span><span class="check__label">…</span></label>
   <label class="radio"><input type="radio"><span class="radio__dot"></span><span class="radio__label">…</span></label>
   ========================================================================== */
.toggle,
.check,
.radio {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2-5);
  min-height: var(--hit-min);
  cursor: pointer;
  color: var(--text-1);
  font-size: var(--fs-md);
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
}

.toggle > input,
.check > input,
.radio > input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
  z-index: 1;
}

.toggle__track {
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 24px;
  border-radius: var(--r-pill);
  background-color: var(--neutral-soft);
  border: 1px solid var(--line-3);
  transition:
    background-color var(--dur-3) var(--ease-out),
    border-color var(--dur-3) var(--ease-out),
    box-shadow var(--dur-3) var(--ease-out);
}
.toggle__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--text-2);
  box-shadow: var(--shadow-1);
  transition:
    transform var(--dur-3) var(--ease-spring),
    background-color var(--dur-3) var(--ease-out);
}
.toggle > input:checked + .toggle__track {
  background-image: var(--accent-grad);
  border-color: transparent;
  box-shadow: var(--glow-accent);
}
.toggle > input:checked + .toggle__track::after {
  transform: translateX(18px);
  background-color: var(--text-on-accent);
}
.toggle > input:focus-visible + .toggle__track {
  box-shadow: var(--ring);
}
.toggle > input:disabled ~ * {
  opacity: 0.45;
}
.toggle:has(> input:disabled),
.check:has(> input:disabled),
.radio:has(> input:disabled) {
  cursor: not-allowed;
}

.check__box,
.radio__dot {
  position: relative;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line-3);
  background-color: var(--surface-sunken);
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out);
}
.check__box {
  border-radius: var(--r-sm);
}
.radio__dot {
  border-radius: 50%;
}
.check:hover .check__box,
.radio:hover .radio__dot {
  border-color: var(--accent);
}
.check__box::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--text-on-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform var(--dur-2) var(--ease-spring);
}
.check > input:checked + .check__box,
.check > input:indeterminate + .check__box {
  background-image: var(--accent-grad);
  border-color: transparent;
}
.check > input:checked + .check__box::after {
  transform: rotate(45deg) scale(1);
}
.check > input:indeterminate + .check__box::after {
  left: 4px;
  top: 8px;
  width: 9px;
  height: 0;
  border-width: 0 0 2px 0;
  transform: none;
}
.radio__dot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background-image: var(--accent-grad);
  transform: scale(0);
  transition: transform var(--dur-2) var(--ease-spring);
}
.radio > input:checked + .radio__dot {
  border-color: var(--accent);
}
.radio > input:checked + .radio__dot::after {
  transform: scale(1);
}
.check > input:focus-visible + .check__box,
.radio > input:focus-visible + .radio__dot {
  box-shadow: var(--ring);
}
.check > input:disabled ~ *,
.radio > input:disabled ~ * {
  opacity: 0.45;
}
.toggle__label small,
.check__label small,
.radio__label small {
  display: block;
  color: var(--text-3);
  font-size: var(--fs-sm);
}

/* ==========================================================================
   04 タブ / セグメント切替 / チップ
   .tabs > .tabs__list[role=tablist] > .tabs__tab[role=tab][aria-selected]   + .tabs__panel
   .segmented > .segmented__item[aria-pressed="true"]（または .is-active）
   ========================================================================== */
.tabs {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
}
.tabs__list {
  display: flex;
  align-items: stretch;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--line-1);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs__list::-webkit-scrollbar {
  display: none;
}
.tabs__tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 44px;
  padding: 0 var(--sp-3);
  color: var(--text-3);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  border-radius: var(--r-md) var(--r-md) 0 0;
  transition:
    color var(--dur-2) var(--ease-out),
    background-color var(--dur-2) var(--ease-out);
}
.tabs__tab svg {
  width: 16px;
  height: 16px;
}
.tabs__tab::after {
  content: "";
  position: absolute;
  left: var(--sp-2);
  right: var(--sp-2);
  bottom: -1px;
  height: 2px;
  border-radius: var(--r-pill);
  background-image: var(--accent-grad);
  box-shadow: var(--glow-dot);
  transform: scaleX(0);
  transition: transform var(--dur-3) var(--ease-out);
}
.tabs__tab:hover {
  color: var(--text-1);
  background-color: var(--neutral-soft);
}
.tabs__tab[aria-selected="true"],
.tabs__tab.is-active {
  color: var(--text-1);
}
.tabs__tab[aria-selected="true"]::after,
.tabs__tab.is-active::after {
  transform: scaleX(1);
}
.tabs__tab:focus-visible {
  box-shadow: var(--ring-inset);
}
.tabs__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 var(--sp-1-5);
  border-radius: var(--r-pill);
  background-color: var(--neutral-soft);
  color: var(--text-2);
  font-family: var(--font-num);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.tabs__tab[aria-selected="true"] .tabs__count,
.tabs__tab.is-active .tabs__count {
  background-color: var(--accent-soft);
  color: var(--accent-fg);
}
.tabs__panel {
  min-width: 0;
}
.tabs__panel:focus-visible {
  border-radius: var(--r-md);
}

.segmented {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  height: var(--control-h-md);
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-control);
  background-color: var(--surface-sunken);
  max-width: 100%;
}
.segmented__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1-5);
  min-width: 44px;
  padding: 0 var(--sp-3);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  transition:
    background-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out);
}
.segmented__item svg {
  width: 15px;
  height: 15px;
}
.segmented__item:hover {
  color: var(--text-1);
  background-color: var(--neutral-soft);
}
.segmented__item[aria-pressed="true"],
.segmented__item[aria-checked="true"],
.segmented__item.is-active {
  background-color: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-fg);
}
.segmented--block {
  display: flex;
  width: 100%;
}
.segmented--block .segmented__item {
  flex: 1 1 0;
}
.segmented--sm {
  height: var(--hit-min);
}

/* 絞り込みチップ（押すとON/OFF） */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1-5);
  height: var(--control-h-sm);
  padding: 0 var(--sp-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background-color: transparent;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  position: relative;
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out);
}
.chip::before {
  content: "";
  position: absolute;
  inset: -3px 0;
}
.chip svg {
  width: 14px;
  height: 14px;
}
.chip:hover {
  border-color: var(--line-3);
  color: var(--text-1);
  background-color: var(--neutral-soft);
}
.chip[aria-pressed="true"],
.chip.is-active {
  border-color: var(--accent-line);
  background-color: var(--accent-soft);
  color: var(--accent-fg);
}

/* ==========================================================================
   05 バッジ
   .badge + トーン: --neutral(既定) | --accent | --violet | --success | --warn | --danger | --info
   形: .badge--solid | .badge--outline | .badge--lg     点: <i class="badge__dot"></i>
   モール:   .badge.badge--mall[data-mall="amazon|rakuten|yahoo_shopping|mercari|yahoo_auction|rakuma|yahoo_flea|store|wholesale|other"]
   判定:     .badge.badge--verdict[data-level="go|check|pass"]
   ステータス: .badge.badge--status[data-status="candidate|purchased|listed|sold|archived"]
   ========================================================================== */
.badge {
  --_bg: var(--neutral-soft);
  --_fg: var(--neutral-fg);
  --_line: var(--neutral-line);
  --_solid: var(--neutral);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--_line);
  border-radius: var(--r-pill);
  background-color: var(--_bg);
  color: var(--_fg);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  vertical-align: middle;
  flex-shrink: 0;
}
.badge svg {
  width: 13px;
  height: 13px;
  margin-left: -1px;
}
.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--_solid);
  flex-shrink: 0;
}

.badge--accent { --_bg: var(--accent-soft); --_fg: var(--accent-fg); --_line: var(--accent-line); --_solid: var(--accent); }
.badge--violet { --_bg: var(--violet-soft); --_fg: var(--violet-fg); --_line: var(--violet-line); --_solid: var(--violet); }
.badge--success { --_bg: var(--success-soft); --_fg: var(--success-fg); --_line: var(--success-line); --_solid: var(--success); }
.badge--warn { --_bg: var(--warn-soft); --_fg: var(--warn-fg); --_line: var(--warn-line); --_solid: var(--warn); }
.badge--danger { --_bg: var(--danger-soft); --_fg: var(--danger-fg); --_line: var(--danger-line); --_solid: var(--danger); }
.badge--info { --_bg: var(--info-soft); --_fg: var(--info-fg); --_line: var(--info-line); --_solid: var(--info); }

.badge--solid {
  background-color: var(--_solid);
  border-color: transparent;
  color: var(--text-on-solid);
}
.badge--outline {
  background-color: transparent;
}
.badge--lg {
  height: 26px;
  padding: 0 var(--sp-2-5);
  font-size: var(--fs-sm);
}
.badge--lg svg {
  width: 15px;
  height: 15px;
}

/* モール: 色つきの点＋通常の文字色（色だけに頼らない） */
.badge--mall {
  --_c: var(--mall-other-rgb);
  background-color: rgb(var(--_c) / var(--mall-tint));
  border-color: rgb(var(--_c) / var(--mall-line));
  color: var(--text-1);
  font-weight: var(--fw-medium);
}
.badge--mall .badge__dot {
  width: 7px;
  height: 7px;
  background-color: rgb(var(--_c));
}
.badge--mall[data-mall="amazon"] { --_c: var(--mall-amazon-rgb); }
.badge--mall[data-mall="rakuten"] { --_c: var(--mall-rakuten-rgb); }
.badge--mall[data-mall="yahoo_shopping"] { --_c: var(--mall-yahoo-shopping-rgb); }
.badge--mall[data-mall="mercari"] { --_c: var(--mall-mercari-rgb); }
.badge--mall[data-mall="yahoo_auction"] { --_c: var(--mall-yahoo-auction-rgb); }
.badge--mall[data-mall="rakuma"] { --_c: var(--mall-rakuma-rgb); }
.badge--mall[data-mall="yahoo_flea"] { --_c: var(--mall-yahoo-flea-rgb); }
.badge--mall[data-mall="store"] { --_c: var(--mall-store-rgb); }
.badge--mall[data-mall="wholesale"] { --_c: var(--mall-wholesale-rgb); }
.badge--mall[data-mall="other"] { --_c: var(--mall-other-rgb); }

/* 判定: 仕入れ候補 / 要確認 / 見送り（アイコン付き） */
.badge--verdict {
  height: 24px;
  padding: 0 var(--sp-2-5) 0 var(--sp-2);
  font-size: var(--fs-xs);
}
.badge--verdict svg {
  width: 14px;
  height: 14px;
}
.badge--verdict[data-level="go"] { --_bg: var(--success-soft); --_fg: var(--success-fg); --_line: var(--success-line); --_solid: var(--success); }
.badge--verdict[data-level="check"] { --_bg: var(--warn-soft); --_fg: var(--warn-fg); --_line: var(--warn-line); --_solid: var(--warn); }
.badge--verdict[data-level="pass"] { --_bg: var(--danger-soft); --_fg: var(--danger-fg); --_line: var(--danger-line); --_solid: var(--danger); }
.badge--verdict.badge--lg {
  height: 30px;
  padding: 0 var(--sp-3) 0 var(--sp-2-5);
  font-size: var(--fs-md);
}
.badge--verdict.badge--lg svg {
  width: 17px;
  height: 17px;
}

/* 商品ステータス */
.badge--status[data-status="candidate"] { --_bg: var(--info-soft); --_fg: var(--info-fg); --_line: var(--info-line); --_solid: var(--info); }
.badge--status[data-status="purchased"] { --_bg: var(--violet-soft); --_fg: var(--violet-fg); --_line: var(--violet-line); --_solid: var(--violet); }
.badge--status[data-status="listed"] { --_bg: var(--accent-soft); --_fg: var(--accent-fg); --_line: var(--accent-line); --_solid: var(--accent); }
.badge--status[data-status="sold"] { --_bg: var(--success-soft); --_fg: var(--success-fg); --_line: var(--success-line); --_solid: var(--success); }
.badge--status[data-status="archived"] { --_bg: var(--neutral-soft); --_fg: var(--text-3); --_line: var(--neutral-line); --_solid: var(--neutral); }

/* 件数の丸バッジ（未読数など） */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background-color: var(--danger);
  color: var(--text-on-danger);
  font-family: var(--font-num);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  line-height: 1;
}
.count-badge--accent {
  background-color: var(--accent);
  color: var(--text-on-accent);
}

/* 状態の点 */
.dot {
  --_c: var(--neutral);
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--_c);
  flex-shrink: 0;
}
.dot--accent { --_c: var(--accent); }
.dot--success { --_c: var(--success); }
.dot--warn { --_c: var(--warn); }
.dot--danger { --_c: var(--danger); }
.dot--info { --_c: var(--info); }
.dot--violet { --_c: var(--violet); }
.dot--glow {
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.16), 0 0 10px var(--_c);
}

/* キーボードのキー表示 */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 var(--sp-1-5);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
  background-color: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-num);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1;
  white-space: nowrap;
}

/* ==========================================================================
   06 カード
   .card > .card__header(.card__title + .card__actions) + .card__body + .card__footer
   修飾: .card--hud（四隅のブラケット） | .card--accent | .card--interactive | .card--flush | .card--sunken | .card--compact
   ========================================================================== */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line-1);
  border-radius: var(--radius-card);
  background-color: var(--surface-1);
  background-image: var(--surface-sheen);
  box-shadow: var(--shadow-panel);
}
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5) 0;
  min-height: 52px;
  min-width: 0;
}
.card__heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.card__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
  min-width: 0;
}
.card__title svg {
  width: 18px;
  height: 18px;
  color: var(--accent-fg);
}
.card__subtitle {
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.card__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1-5);
  flex-shrink: 0;
}
.card__body {
  flex: 1 1 auto;
  padding: var(--sp-5);
  min-width: 0;
}
.card__header + .card__body {
  padding-top: var(--sp-3);
}
.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--line-1);
  color: var(--text-2);
  font-size: var(--fs-sm);
  min-width: 0;
}
.card--compact .card__header {
  padding: var(--sp-3) var(--sp-4) 0;
  min-height: 44px;
}
.card--compact .card__body {
  padding: var(--sp-4);
}
.card--compact .card__header + .card__body {
  padding-top: var(--sp-2);
}
.card--flush .card__body {
  padding: 0;
}
.card--flush .card__header {
  padding-bottom: var(--sp-3);
}
.card--sunken {
  background-color: var(--surface-sunken);
  background-image: none;
  box-shadow: none;
}
.card--accent {
  border-color: var(--accent-line);
  background-image: var(--accent-grad-soft);
}
.card--interactive {
  cursor: pointer;
  transition:
    transform var(--dur-3) var(--ease-out),
    border-color var(--dur-3) var(--ease-out),
    box-shadow var(--dur-3) var(--ease-out);
}
.card--interactive:hover {
  transform: translateY(-2px);
  border-color: var(--line-3);
  box-shadow: inset 0 1px 0 var(--highlight), var(--shadow-3);
}

/* HUD: 四隅だけアクセント色の枠を見せる（角丸に沿ったブラケット） */
.card--hud::after,
.hud-corners::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--accent);
  border-radius: inherit;
  opacity: 0.75;
  pointer-events: none;
  --_s: 16px;
  -webkit-mask:
    linear-gradient(black, black) top left / var(--_s) var(--_s) no-repeat,
    linear-gradient(black, black) top right / var(--_s) var(--_s) no-repeat,
    linear-gradient(black, black) bottom left / var(--_s) var(--_s) no-repeat,
    linear-gradient(black, black) bottom right / var(--_s) var(--_s) no-repeat;
  mask:
    linear-gradient(black, black) top left / var(--_s) var(--_s) no-repeat,
    linear-gradient(black, black) top right / var(--_s) var(--_s) no-repeat,
    linear-gradient(black, black) bottom left / var(--_s) var(--_s) no-repeat,
    linear-gradient(black, black) bottom right / var(--_s) var(--_s) no-repeat;
}
.hud-corners {
  position: relative;
}

/* ==========================================================================
   07 KPIカード / ゲージ / メーター
   .kpi > .kpi__head(.kpi__label + .kpi__icon) + .kpi__value(.kpi__num + .kpi__unit) + .kpi__foot(.kpi__delta + .kpi__note + .kpi__spark)
   トーン: .kpi--accent(既定) | --violet | --success | --warn | --danger
   ========================================================================== */
.kpi {
  --_c: var(--accent-rgb);
  --_fg: var(--accent-fg);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-card);
  background-color: var(--surface-1);
  background-image: var(--surface-sheen);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
/* 上辺の計器ライン */
.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--sp-5);
  width: 36px;
  height: 2px;
  border-radius: 0 0 var(--r-pill) var(--r-pill);
  background-color: rgb(var(--_c));
  box-shadow: 0 0 12px rgb(var(--_c) / 0.8);
}
.kpi--violet { --_c: var(--violet-rgb); --_fg: var(--violet-fg); }
.kpi--success { --_c: var(--success-rgb); --_fg: var(--success-fg); }
.kpi--warn { --_c: var(--warn-rgb); --_fg: var(--warn-fg); }
.kpi--danger { --_c: var(--danger-rgb); --_fg: var(--danger-fg); }

.kpi__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-height: 28px;
}
.kpi__label {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.4;
}
.kpi__icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  background-color: rgb(var(--_c) / 0.14);
  color: var(--_fg);
  flex-shrink: 0;
}
.kpi__icon svg {
  width: 16px;
  height: 16px;
}
.kpi__value {
  display: flex;
  align-items: baseline;
  gap: var(--sp-1);
  min-width: 0;
  line-height: var(--lh-tight);
}
.kpi__num {
  font-family: var(--font-num);
  font-size: var(--fs-4xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
  color: var(--text-1);
  white-space: nowrap;
  font-variant-numeric: lining-nums;
}
.kpi__unit {
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}
.kpi__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 24px;
  min-width: 0;
}
.kpi__note {
  min-width: 0;
  color: var(--text-3);
  font-size: var(--fs-xs);
  overflow-wrap: anywhere; /* 長い補足は折り返す（カードの端で切れない） */
}
.kpi__spark {
  margin-left: auto;
  flex-shrink: 0;
  color: rgb(var(--_c));
}
.kpi--lg .kpi__num {
  font-size: var(--fs-5xl);
}
.kpi--interactive {
  cursor: pointer;
  transition:
    transform var(--dur-3) var(--ease-out),
    border-color var(--dur-3) var(--ease-out);
}
.kpi--interactive:hover {
  transform: translateY(-2px);
  border-color: var(--line-3);
}

/* 増減表示: ▲12.4% など。良し悪しは .is-good / .is-bad で色分け（上がる＝良いとは限らない） */
.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-num);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-2);
  white-space: nowrap;
}
.delta svg {
  width: 14px;
  height: 14px;
}
.delta.is-good { color: var(--success-fg); }
.delta.is-bad { color: var(--danger-fg); }

/* ゲージ（270度の計器）。JS: ui.gauge() が SVG を組み立てる */
.gauge {
  --gauge-size: 240px;
  position: relative;
  width: var(--gauge-size);
  max-width: 100%;
  aspect-ratio: 1 / 0.88;
  flex-shrink: 0;
}
.gauge__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.gauge__track {
  fill: none;
  stroke: var(--line-2);
  stroke-linecap: round;
}
.gauge__bar {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 700ms var(--ease-out);
}
.gauge__glow {
  fill: none;
  stroke-linecap: round;
  opacity: 0.45;
  filter: blur(6px);
  transition: stroke-dashoffset 700ms var(--ease-out);
}
.gauge__tick {
  stroke: var(--line-2);
  stroke-width: 1;
}
.gauge__tick--major {
  stroke: var(--line-3);
  stroke-width: 1.5;
}
.gauge__tick.is-on {
  stroke: var(--accent);
  opacity: 0.85;
}
.gauge__stop-1 { stop-color: var(--accent); }
.gauge__stop-2 { stop-color: var(--accent-2); }
.gauge__stop-3 { stop-color: var(--violet); }
.gauge--success .gauge__stop-1,
.gauge--success .gauge__stop-2,
.gauge--success .gauge__stop-3 { stop-color: var(--success); }
.gauge--warn .gauge__stop-1,
.gauge--warn .gauge__stop-2,
.gauge--warn .gauge__stop-3 { stop-color: var(--warn); }
.gauge--danger .gauge__stop-1,
.gauge--danger .gauge__stop-2,
.gauge--danger .gauge__stop-3 { stop-color: var(--danger); }
.gauge__knob {
  fill: var(--text-1);
  stroke: var(--accent);
  stroke-width: 2;
  /* ゲージの中心（viewBox の 100,100）まわりに回す。指定しないと SVG の左上が回転の中心になって、つまみが枠の外へ飛ぶ */
  transform-box: view-box;
  transform-origin: 100px 100px;
  transition: transform 700ms var(--ease-out), opacity var(--dur-2) var(--ease-out);
}
.gauge__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding-top: 6%;
  text-align: center;
  pointer-events: none;
}
.gauge__label {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.gauge__value {
  font-family: var(--font-num);
  font-size: calc(var(--gauge-size) * 0.15);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
  line-height: 1.15;
  color: var(--text-1);
  text-shadow: var(--glow-text);
  white-space: nowrap;
  font-variant-numeric: lining-nums;
}
.gauge__sub {
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-family: var(--font-num);
  white-space: nowrap;
}
.gauge__pct {
  position: absolute;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: 26px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-pill);
  background-color: var(--accent-soft);
  color: var(--accent-fg);
  font-family: var(--font-num);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  white-space: nowrap;
}
.gauge--sm { --gauge-size: 160px; }
.gauge--sm .gauge__label { font-size: var(--fs-xs); }
.gauge--sm .gauge__sub { font-size: var(--fs-xs); }
.gauge--sm .gauge__pct { height: 22px; font-size: var(--fs-xs); padding: 0 var(--sp-2); }
.gauge--lg { --gauge-size: 300px; }

/* メーター（横棒の達成度）: 塗りが状態を、同系色の淡い軌道が全体を示す */
.meter {
  --_c: var(--accent-rgb);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1-5);
  min-width: 0;
}
.meter__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
}
.meter__label {
  color: var(--text-2);
}
.meter__value {
  font-family: var(--font-num);
  font-weight: var(--fw-semibold);
  color: var(--text-1);
  white-space: nowrap;
}
.meter__track {
  position: relative;
  height: 8px;
  border-radius: var(--r-pill);
  background-color: rgb(var(--_c) / 0.16);
  overflow: hidden;
}
.meter__bar {
  width: var(--value, 0%);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background-color: rgb(var(--_c));
  transition: width 500ms var(--ease-out);
}
.meter--success { --_c: var(--success-rgb); }
.meter--warn { --_c: var(--warn-rgb); }
.meter--danger { --_c: var(--danger-rgb); }
.meter--violet { --_c: var(--violet-rgb); }

/* 小さな統計（ラベル＋値）。カード内の補助指標に */
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.stat__label {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}
.stat__value {
  font-family: var(--font-num);
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  color: var(--text-1);
  white-space: nowrap;
}
.stat__value small {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  margin-left: 2px;
}
.stat--lg .stat__value {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
}

/* ラベル＝値 の明細（利益の内訳など） */
.kv {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.kv__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--line-1);
  min-width: 0;
}
.kv__row:last-child {
  border-bottom: 0;
}
.kv__label {
  color: var(--text-2);
  min-width: 0;
}
.kv__label small {
  display: block;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.kv__value {
  font-family: var(--font-num);
  font-weight: var(--fw-medium);
  color: var(--text-1);
  white-space: nowrap;
  text-align: right;
}
.kv__row--minus .kv__value {
  color: var(--text-2);
}
.kv__row--total {
  margin-top: var(--sp-1);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line-3);
  border-bottom: 0;
}
.kv__row--total .kv__label {
  color: var(--text-1);
  font-weight: var(--fw-semibold);
}
.kv__row--total .kv__value {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
}

/* ==========================================================================
   08 進捗バー / スピナー / スケルトン
   ========================================================================== */
.progress {
  --_c: var(--accent-rgb);
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: var(--r-pill);
  background-color: rgb(var(--_c) / 0.16);
  overflow: hidden;
}
.progress__bar {
  width: var(--value, 0%);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background-image: linear-gradient(90deg, rgb(var(--_c) / 0.75), rgb(var(--_c)));
  box-shadow: 0 0 10px rgb(var(--_c) / 0.6);
  transition: width 400ms var(--ease-out);
}
.progress--sm { height: 4px; }
.progress--lg { height: 10px; }
.progress--success { --_c: var(--success-rgb); }
.progress--warn { --_c: var(--warn-rgb); }
.progress--danger { --_c: var(--danger-rgb); }
.progress--violet { --_c: var(--violet-rgb); }
.progress--indeterminate .progress__bar {
  width: 38%;
  animation: progress-slide 1.3s var(--ease-in-out) infinite;
}
@keyframes progress-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(290%); }
}
.progress-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}
.progress-row > .progress {
  flex: 1 1 auto;
}
.progress-row__value {
  font-family: var(--font-num);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-2);
  min-width: 3.2em;
  text-align: right;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner--sm { width: 14px; height: 14px; }
.spinner--lg { width: 28px; height: 28px; border-width: 3px; }
.loading-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-10) var(--sp-4);
  color: var(--text-2);
}

.skeleton {
  display: block;
  border-radius: var(--r-md);
  background-color: var(--skeleton-base);
  background-image: linear-gradient(90deg, transparent 0%, var(--skeleton-shine) 50%, transparent 100%);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: skeleton-shine 1.4s var(--ease-in-out) infinite;
}
@keyframes skeleton-shine {
  0% { background-position: 200% 0; }
  100% { background-position: -100% 0; }
}
.skeleton--text { height: 0.9em; margin: 0.35em 0; }
.skeleton--title { height: 1.5em; width: 42%; }
.skeleton--circle { border-radius: 50%; width: 40px; height: 40px; }
.skeleton--block { height: 120px; border-radius: var(--radius-card); }
.skeleton--kpi { height: 118px; border-radius: var(--radius-card); }
.skeleton--row { height: 44px; }
.skeleton--chart { height: 240px; border-radius: var(--radius-card); }
.skeleton-stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* ==========================================================================
   09 テーブル
   .table-wrap(.table-wrap--scroll で固定ヘッダ＋縦スクロール / --flush でカード内用)
     > table.table(.table--compact | --comfortable | --striped)
   th.is-sortable[aria-sort="ascending|descending|none"] > button.table__sort
   数値列: th.num / td.num（右寄せ・等幅数字）
   ========================================================================== */
.table-wrap {
  position: relative;
  overflow: auto;
  border: 1px solid var(--line-1);
  border-radius: var(--radius-card);
  background-color: var(--surface-1);
  box-shadow: var(--shadow-panel);
  min-width: 0;
}
.table-wrap--scroll {
  max-height: var(--table-max-h, 520px);
}
.table-wrap--flush {
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.card > .table-wrap--flush:last-child {
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.table {
  --row-h: 52px;
  --cell-px: var(--sp-2-5);
  width: 100%;
  font-size: var(--fs-md);
  line-height: 1.5;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 40px;
  padding: 0 var(--cell-px);
  background-color: var(--surface-solid-2);
  border-bottom: 1px solid var(--line-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
}
.table td {
  height: var(--row-h);
  padding: var(--sp-2) var(--cell-px);
  border-bottom: 1px solid var(--line-1);
  color: var(--text-1);
  vertical-align: middle;
}
.table th:first-child,
.table td:first-child {
  padding-left: var(--sp-4);
}
.table th:last-child,
.table td:last-child {
  padding-right: var(--sp-4);
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table tbody tr {
  transition: background-color var(--dur-1) var(--ease-out);
}
.table tbody tr:hover {
  background-color: rgb(var(--accent-rgb) / 0.07);
}
.table tbody tr.is-selected {
  background-color: var(--accent-soft);
}
.table tbody tr.is-clickable {
  cursor: pointer;
}
.table tbody tr:focus-visible {
  box-shadow: var(--ring-inset);
}
.table th.num,
.table td.num {
  text-align: right;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table th.center,
.table td.center {
  text-align: center;
}
.table td.muted {
  color: var(--text-3);
}
.table td.is-pos { color: var(--pos-fg); }
.table td.is-neg { color: var(--neg-fg); }
.table td strong {
  font-weight: var(--fw-semibold);
}

/* 密度 */
.table--compact {
  --row-h: 40px;
  --cell-px: var(--sp-2-5);
  font-size: var(--fs-sm);
}
.table--compact th {
  height: 36px;
}
.table--compact td {
  padding-top: var(--sp-1);
  padding-bottom: var(--sp-1);
}
.table--comfortable {
  --row-h: 64px;
  --cell-px: var(--sp-4);
}
.table--striped tbody tr:nth-child(even) {
  background-color: var(--neutral-soft);
}
.table--fixed {
  table-layout: fixed;
}

/* ソート */
.table__sort {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: 40px;
  margin: 0 calc(var(--sp-1) * -1);
  padding: 0 var(--sp-1);
  border-radius: var(--r-sm);
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  white-space: nowrap;
  transition: color var(--dur-2) var(--ease-out);
}
.table__sort:hover {
  color: var(--text-1);
}
.table__sort svg {
  width: 14px;
  height: 14px;
  opacity: 0.55;
}
.table th.num .table__sort {
  flex-direction: row-reverse;
}
.table th[aria-sort="ascending"],
.table th[aria-sort="descending"] {
  color: var(--accent-fg);
}
.table th[aria-sort="ascending"] .table__sort svg,
.table th[aria-sort="descending"] .table__sort svg {
  opacity: 1;
}
.table--compact .table__sort {
  height: 36px;
}

/* 順位 */
.rank {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 var(--sp-1);
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background-color: var(--surface-sunken);
  color: var(--text-2);
  font-family: var(--font-num);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}
.rank--top {
  border-color: var(--accent-line);
  background-image: var(--accent-grad-soft);
  color: var(--accent-fg);
}
.rank-move {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-num);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-3);
  white-space: nowrap;
}
.rank-move svg {
  width: 12px;
  height: 12px;
}
.rank-move.is-up { color: var(--success-fg); }
.rank-move.is-down { color: var(--danger-fg); }
.rank-move.is-new { color: var(--violet-fg); }

/* 商品セル（サムネイル＋商品名＋補足） */
.cell-product {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}
.cell-product__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cell-product__title {
  color: var(--text-1);
  font-weight: var(--fw-medium);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
/* 表の中の商品名は2行まで折り返して省略する（全文は title 属性で見られる）。列は縮められる */
.table .cell-product__title {
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
}
.table .cell-product {
  min-width: 0;
}
.table .cell-product__title .badge {
  margin-left: var(--sp-1-5);
  vertical-align: 0.1em;
}
.table .cell-product__text,
.table .cell-product__meta,
.table .cell-product__meta > span {
  overflow-wrap: anywhere;
}
.cell-product__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-family: var(--font-num);
}
.cell-product__meta--1line {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* 長い文字が表の列幅を押し広げない（width:0 + min-width:100% で、列の幅は他のセルで決まる） */
  width: 0;
  min-width: 100%;
}
.table__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-1);
}

/* 表の下の帯（件数・ページ送り） */
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-5);
  border-top: 1px solid var(--line-1);
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.pagination {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}
.pagination__info {
  padding: 0 var(--sp-2);
  font-family: var(--font-num);
  color: var(--text-2);
  white-space: nowrap;
}

/* ==========================================================================
   10 カンバン
   .kanban > .kanban__col[data-status] > .kanban__col-head + .kanban__list > .kanban-card
   ドラッグ中: .kanban-card.is-dragging / 落とし先: .kanban__col.is-drop-target / 挿入位置: .kanban__placeholder
   ========================================================================== */
.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: var(--sp-4);
  align-items: start;
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  min-width: 0;
}
.kanban__col {
  --_c: var(--neutral-rgb);
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: var(--kanban-max-h, none);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-card);
  background-color: var(--surface-sunken);
  transition:
    border-color var(--dur-2) var(--ease-out),
    background-color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out);
}
.kanban__col[data-status="candidate"] { --_c: var(--info-rgb); }
.kanban__col[data-status="purchased"] { --_c: var(--violet-rgb); }
.kanban__col[data-status="listed"] { --_c: var(--accent-rgb); }
.kanban__col[data-status="sold"] { --_c: var(--success-rgb); }
.kanban__col-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-3) var(--sp-4) var(--sp-2-5);
  border-bottom: 1px solid var(--line-1);
  border-top: 2px solid rgb(var(--_c));
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background-image: linear-gradient(180deg, rgb(var(--_c) / 0.10), rgb(var(--_c) / 0));
}
.kanban__col-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--sp-8); /* 見出しの高さを列でそろえる（＋ボタンがある列と同じ高さ） */
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}
.kanban__col-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 var(--sp-1-5);
  border-radius: var(--r-pill);
  background-color: rgb(var(--_c) / 0.18);
  color: var(--text-1);
  font-family: var(--font-num);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
}
.kanban__col-actions {
  margin-left: auto;
  display: flex;
  gap: var(--sp-1);
}
.kanban__col-sum {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-family: var(--font-num);
}
.kanban__list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-2-5);
  min-height: 72px;
  overflow-y: auto;
}
.kanban__col-foot {
  padding: 0 var(--sp-2-5) var(--sp-2-5);
}
.kanban__col.is-drop-target {
  border-color: var(--accent-line);
  background-color: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line), 0 0 24px -6px rgb(var(--accent-rgb) / 0.45);
}
.kanban__placeholder {
  height: 56px;
  border: 1.5px dashed var(--accent-line);
  border-radius: var(--r-lg);
  background-color: var(--accent-soft);
}
.kanban__empty {
  display: grid;
  place-items: center;
  padding: var(--sp-5) var(--sp-3);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  color: var(--text-3);
  font-size: var(--fs-sm);
  text-align: center;
}

.kanban-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  background-color: var(--surface-2);
  box-shadow: inset 0 1px 0 var(--highlight), var(--shadow-1);
  cursor: grab;
  transition:
    transform var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out),
    opacity var(--dur-2) var(--ease-out);
}
.kanban-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-3);
  box-shadow: inset 0 1px 0 var(--highlight), var(--shadow-2);
}
.kanban-card:active {
  cursor: grabbing;
}
.kanban-card.is-dragging {
  opacity: 0.45;
  transform: rotate(1.5deg) scale(0.98);
  border-style: dashed;
  border-color: var(--accent-line);
}
.kanban-card.is-lifted {
  transform: rotate(2deg) scale(1.02);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-pop), var(--glow-accent);
  cursor: grabbing;
}
.kanban-card__top {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2-5);
  min-width: 0;
}
.kanban-card__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  min-width: 0;
}
.kanban-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1-5);
  min-width: 0;
}
.kanban-card__nums {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--line-1);
  font-family: var(--font-num);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.kanban-card__nums strong {
  color: var(--text-1);
  font-size: var(--fs-md);
}
.kanban-card__alert {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--warn-fg);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}
.kanban-card__alert svg {
  width: 13px;
  height: 13px;
}

/* ==========================================================================
   11 モーダル / ドロワー
   .overlay（背景の幕）> .modal(.modal--sm|--md|--lg|--xl) > .modal__header + .modal__body + .modal__footer
   .overlay > .drawer(.drawer--left | .drawer--wide) > .drawer__header + .drawer__body + .drawer__footer
   閉じるとき: .overlay.is-closing
   ========================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--sp-6);
  background-color: var(--scrim);
  -webkit-backdrop-filter: var(--blur-overlay);
  backdrop-filter: var(--blur-overlay);
  animation: fade-in var(--dur-3) var(--ease-out) both;
  overflow: hidden;
}
.overlay--drawer {
  z-index: var(--z-drawer);
  display: block;
  padding: 0;
}
.overlay.is-closing {
  animation: fade-out var(--dur-2) var(--ease-out) both;
  pointer-events: none;
}
@keyframes fade-out {
  to { opacity: 0; }
}

.modal {
  --modal-w: 560px;
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, var(--modal-w));
  max-height: calc(100vh - var(--sp-12));
  border: 1px solid var(--line-2);
  border-radius: var(--radius-modal);
  background-color: var(--surface-overlay);
  background-image: var(--surface-sheen);
  box-shadow: inset 0 1px 0 var(--highlight), var(--shadow-3);
  -webkit-backdrop-filter: var(--blur-glass);
  backdrop-filter: var(--blur-glass);
  animation: modal-in var(--dur-4) var(--ease-out) both;
  min-width: 0;
}
.modal--sm { --modal-w: 420px; }
.modal--md { --modal-w: 560px; }
.modal--lg { --modal-w: 760px; }
.modal--xl { --modal-w: 1000px; }
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.overlay.is-closing .modal {
  animation: modal-out var(--dur-2) var(--ease-out) both;
}
@keyframes modal-out {
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.99);
  }
}
.modal__header,
.drawer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-3) var(--sp-6);
  flex-shrink: 0;
}
.modal__heading,
.drawer__heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-top: var(--sp-1);
}
.modal__title,
.drawer__title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
}
.modal__subtitle,
.drawer__subtitle {
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.modal__close,
.drawer__close {
  margin: calc(var(--sp-1) * -1) calc(var(--sp-1) * -1) 0 0;
}
.modal__body,
.drawer__body {
  flex: 1 1 auto;
  padding: var(--sp-2) var(--sp-6) var(--sp-5);
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
  color: var(--text-2);
}
.modal__body > :where(p) + :where(p) {
  margin-top: var(--sp-3);
}
.modal__footer,
.drawer__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--line-1);
  flex-shrink: 0;
}
.modal__footer-note {
  margin-right: auto;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
/* 確認ダイアログのアイコン */
.modal__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-xl);
  background-color: var(--accent-soft);
  color: var(--accent-fg);
  flex-shrink: 0;
}
.modal__icon svg {
  width: 22px;
  height: 22px;
}
.modal__icon--danger {
  background-color: var(--danger-soft);
  color: var(--danger-fg);
}
.modal__icon--warn {
  background-color: var(--warn-soft);
  color: var(--warn-fg);
}
.modal__lead {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(var(--drawer-w), 100vw);
  border-left: 1px solid var(--line-2);
  background-color: var(--surface-overlay);
  background-image: var(--surface-sheen);
  box-shadow: var(--shadow-3);
  -webkit-backdrop-filter: var(--blur-glass);
  backdrop-filter: var(--blur-glass);
  animation: drawer-in var(--dur-4) var(--ease-out) both;
}
.drawer--wide { --drawer-w: 640px; }
.drawer--xwide { --drawer-w: 820px; }
.drawer--left {
  right: auto;
  left: 0;
  border-left: 0;
  border-right: 1px solid var(--line-2);
  animation-name: drawer-in-left;
}
@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes drawer-in-left {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.overlay.is-closing .drawer {
  animation: drawer-out var(--dur-2) var(--ease-out) both;
}
.overlay.is-closing .drawer--left {
  animation-name: drawer-out-left;
}
@keyframes drawer-out {
  to {
    opacity: 0;
    transform: translateX(16px);
  }
}
@keyframes drawer-out-left {
  to {
    opacity: 0;
    transform: translateX(-16px);
  }
}
.drawer__header {
  border-bottom: 1px solid var(--line-1);
  padding-bottom: var(--sp-4);
}
.drawer__body {
  padding-top: var(--sp-4);
}

/* ==========================================================================
   12 トースト（4種: info / success / warn / error）
   ========================================================================== */
.toast-region {
  position: fixed;
  right: var(--sp-5);
  bottom: var(--sp-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--sp-2-5);
  width: min(400px, calc(100vw - var(--sp-8)));
  pointer-events: none;
}
/* モーダル・ドロワーが開いている間は、下部のボタン（保存・キャンセル）に重ならないよう画面の上に出す */
html[data-overlay] .toast-region {
  top: var(--sp-5);
  bottom: auto;
  right: auto;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: column;
}
.toast {
  --_c: var(--info-rgb);
  --_fg: var(--info-fg);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  border: 1px solid rgb(var(--_c) / 0.45);
  border-radius: var(--r-xl);
  background-color: var(--surface-solid);
  background-image: linear-gradient(90deg, rgb(var(--_c) / 0.14), rgb(var(--_c) / 0) 60%);
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  overflow: hidden;
  animation: toast-in var(--dur-4) var(--ease-out) both;
}
.toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: rgb(var(--_c));
  box-shadow: 0 0 12px rgb(var(--_c) / 0.8);
}
.toast--success { --_c: var(--success-rgb); --_fg: var(--success-fg); }
.toast--warn { --_c: var(--warn-rgb); --_fg: var(--warn-fg); }
.toast--error { --_c: var(--danger-rgb); --_fg: var(--danger-fg); }
.toast.is-leaving {
  animation: toast-out var(--dur-2) var(--ease-out) both;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(16px);
  }
}
.toast__icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--_fg);
  flex-shrink: 0;
}
.toast__icon svg {
  width: 20px;
  height: 20px;
}
.toast__content {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 1px;
}
.toast__title {
  color: var(--text-1);
  font-weight: var(--fw-semibold);
  line-height: 1.5;
}
.toast__message {
  white-space: pre-line;
  overflow-wrap: anywhere;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.55;
}
.toast__action {
  align-self: center;
  height: var(--control-h-sm);
  padding: 0 var(--sp-2-5);
  border-radius: var(--r-md);
  color: var(--_fg);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  flex-shrink: 0;
}
.toast__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: center;
  flex-shrink: 0;
}
.toast__actions .toast__action {
  align-self: stretch;
  text-align: right;
}
.toast__action:hover {
  background-color: rgb(var(--_c) / 0.16);
}
.toast__close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -2px -2px 0 0;
  border-radius: var(--r-md);
  color: var(--text-3);
  flex-shrink: 0;
}
.toast__close:hover {
  color: var(--text-1);
  background-color: var(--neutral-soft);
}
.toast__close svg {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   13 ツールチップ / ドロップダウンメニュー / コマンドパレット
   ========================================================================== */
/* JSで位置決めするツールチップ */
.tooltip {
  position: fixed;
  z-index: var(--z-tooltip);
  max-width: 300px;
  padding: var(--sp-1-5) var(--sp-2-5);
  border: 1px solid var(--tooltip-line);
  border-radius: var(--r-md);
  background-color: var(--tooltip-bg);
  color: var(--tooltip-fg);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1.55;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
  animation: fade-in var(--dur-1) var(--ease-out) both;
}
.tooltip__title {
  font-weight: var(--fw-semibold);
}
.tooltip__kbd {
  margin-left: var(--sp-2);
  opacity: 0.75;
  font-family: var(--font-num);
}

/* ツールチップは js/ui/tooltip.js が body 直下の .tooltip を出す（[data-tip] は属性のみ。CSS の疑似要素は使わない:
   表やスクロール領域で切れる・横スクロールを作るため） */
[data-tip] {
  position: relative;
}
.tooltip--tip {
  width: max-content;
  white-space: normal;
  text-align: left;
  font-family: var(--font-sans);
  letter-spacing: 0;
  text-transform: none;
}
.tooltip[hidden] {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .tooltip {
    animation: none;
  }
}

/* ドロップダウンメニュー / ポップオーバー */
.menu,
.popover {
  position: absolute;
  z-index: var(--z-dropdown);
  min-width: 200px;
  max-width: min(360px, calc(100vw - var(--sp-6)));
  padding: var(--sp-1-5);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  background-color: var(--surface-overlay);
  box-shadow: var(--shadow-pop);
  -webkit-backdrop-filter: var(--blur-glass);
  backdrop-filter: var(--blur-glass);
  animation: pop-in var(--dur-2) var(--ease-out) both;
  transform-origin: top right;
}
.popover {
  padding: var(--sp-4);
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.menu__label {
  padding: var(--sp-1-5) var(--sp-2-5) var(--sp-1);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
}
.menu__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2-5);
  width: 100%;
  min-height: var(--hit-min);
  padding: var(--sp-1) var(--sp-2-5);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: var(--fs-md);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out);
}
.menu__item svg {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}
.menu__item:hover,
.menu__item:focus-visible,
.menu__item[aria-selected="true"],
.menu__item.is-active {
  background-color: var(--accent-soft);
  box-shadow: none;
  text-decoration: none;
}
.menu__item:hover svg,
.menu__item:focus-visible svg,
.menu__item.is-active svg {
  color: var(--accent-fg);
}
.menu__item[aria-disabled="true"],
.menu__item:disabled {
  opacity: 0.45;
  pointer-events: none;
}
.menu__item--danger {
  color: var(--danger-fg);
}
.menu__item--danger svg {
  color: var(--danger-fg);
}
.menu__item--danger:hover,
.menu__item--danger:focus-visible {
  background-color: var(--danger-soft);
}
.menu__item--danger:hover svg,
.menu__item--danger:focus-visible svg {
  color: var(--danger-fg);
}
.menu__hint,
.menu__shortcut {
  margin-left: auto;
  padding-left: var(--sp-3);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-family: var(--font-num);
  white-space: nowrap;
}
.menu__separator {
  height: 1px;
  margin: var(--sp-1-5) var(--sp-1);
  background-color: var(--line-1);
}

/* コマンドパレット（⌘K） */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-palette);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 14vh var(--sp-4) var(--sp-4);
  background-color: var(--scrim);
  -webkit-backdrop-filter: var(--blur-overlay);
  backdrop-filter: var(--blur-overlay);
  animation: fade-in var(--dur-2) var(--ease-out) both;
}
.cmdk {
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: min(540px, 72vh);
  border: 1px solid var(--line-3);
  border-radius: var(--radius-modal);
  background-color: var(--surface-overlay);
  box-shadow: var(--shadow-3), 0 0 0 1px rgb(var(--accent-rgb) / 0.12), 0 0 60px -12px rgb(var(--accent-rgb) / 0.35);
  -webkit-backdrop-filter: var(--blur-glass);
  backdrop-filter: var(--blur-glass);
  overflow: hidden;
  animation: modal-in var(--dur-3) var(--ease-out) both;
}
.cmdk__search {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: 58px;
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--line-1);
  color: var(--text-3);
  flex-shrink: 0;
}
.cmdk__search svg {
  width: 20px;
  height: 20px;
  color: var(--accent-fg);
}
.cmdk__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--text-1);
  font-size: var(--fs-lg);
}
.cmdk__input::placeholder {
  color: var(--text-4);
}
.cmdk__input:focus,
.cmdk__input:focus-visible {
  box-shadow: none;
}
.cmdk__list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-2);
  overscroll-behavior: contain;
}
.cmdk__group-label {
  padding: var(--sp-2) var(--sp-3) var(--sp-1);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
}
.cmdk__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 44px;
  padding: var(--sp-1-5) var(--sp-3);
  border-radius: var(--r-lg);
  color: var(--text-1);
  text-align: left;
  cursor: pointer;
}
.cmdk__item-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  background-color: var(--neutral-soft);
  color: var(--text-2);
  flex-shrink: 0;
}
.cmdk__item-icon svg {
  width: 16px;
  height: 16px;
}
.cmdk__item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}
.cmdk__item-title {
  font-weight: var(--fw-medium);
  line-height: 1.45;
}
.cmdk__item-title mark {
  background: none;
  color: var(--accent-fg);
  font-weight: var(--fw-bold);
}
.cmdk__item-hint {
  color: var(--text-3);
  font-size: var(--fs-xs);
  line-height: 1.45;
}
.cmdk__item-kbd {
  margin-left: auto;
  display: inline-flex;
  gap: var(--sp-1);
  flex-shrink: 0;
}
.cmdk__item:hover {
  background-color: var(--neutral-soft);
}
.cmdk__item[aria-selected="true"],
.cmdk__item.is-active {
  background-color: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.cmdk__item[aria-selected="true"] .cmdk__item-icon,
.cmdk__item.is-active .cmdk__item-icon {
  background-color: var(--accent-soft-2);
  color: var(--accent-fg);
}
.cmdk__empty {
  padding: var(--sp-8) var(--sp-4);
  color: var(--text-3);
  text-align: center;
}
.cmdk__footer {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-2-5) var(--sp-4);
  border-top: 1px solid var(--line-1);
  color: var(--text-3);
  font-size: var(--fs-xs);
  flex-shrink: 0;
}
.cmdk__footer span {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1-5);
}

/* ==========================================================================
   14 空状態 / エラー状態
   .empty > .empty__icon + .empty__title + .empty__text + .empty__actions
   修飾: .empty--compact | .empty--error | .empty--card
   ========================================================================== */
.empty {
  --_c: var(--accent-rgb);
  --_fg: var(--accent-fg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
  min-width: 0;
}
.empty--card {
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-card);
  background-color: var(--surface-sunken);
}
.empty__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: var(--sp-4);
  border: 1px solid rgb(var(--_c) / 0.45);
  border-radius: 50%;
  background-image: radial-gradient(circle at 50% 35%, rgb(var(--_c) / 0.26), rgb(var(--_c) / 0.05) 70%);
  color: var(--_fg);
  box-shadow: 0 0 32px -6px rgb(var(--_c) / 0.55);
}
/* 軌道（オービット）の輪 */
.empty__icon::before,
.empty__icon::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.empty__icon::before {
  inset: -11px;
  border: 1px dashed rgb(var(--_c) / 0.32);
}
.empty__icon::after {
  top: -14px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  background-color: rgb(var(--_c));
  box-shadow: 0 0 10px rgb(var(--_c));
}
.empty__icon svg {
  width: 28px;
  height: 28px;
}
.empty__title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  color: var(--text-1);
}
.empty__text {
  max-width: 52ch;
  color: var(--text-2);
}
.empty__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}
.empty__detail {
  margin-top: var(--sp-2);
  max-width: 64ch;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  overflow-wrap: anywhere;
}
.empty--compact {
  padding: var(--sp-6) var(--sp-4);
}
.empty--compact .empty__icon {
  width: 44px;
  height: 44px;
  margin-bottom: var(--sp-2);
}
.empty--compact .empty__icon::before {
  inset: -8px;
}
.empty--compact .empty__icon::after {
  top: -11px;
}
.empty--compact .empty__icon svg {
  width: 20px;
  height: 20px;
}
.empty--compact .empty__title {
  font-size: var(--fs-lg);
}
.empty--error {
  --_c: var(--danger-rgb);
  --_fg: var(--danger-fg);
}
.empty--warn {
  --_c: var(--warn-rgb);
  --_fg: var(--warn-fg);
}

/* ==========================================================================
   15 注意書きボックス
   .callout.callout--info | --warn | --danger | --legal | --success
     > .callout__icon + .callout__content(.callout__title + .callout__body) + .callout__actions
   ========================================================================== */
.callout {
  --_c: var(--info-rgb);
  --_fg: var(--info-fg);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4) var(--sp-3) calc(var(--sp-4) + 3px);
  border: 1px solid rgb(var(--_c) / 0.38);
  border-radius: var(--r-lg);
  background-color: rgb(var(--_c) / 0.10);
  color: var(--text-2);
  min-width: 0;
  overflow: hidden;
}
.callout::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: rgb(var(--_c));
}
.callout--info { --_c: var(--info-rgb); --_fg: var(--info-fg); }
.callout--success { --_c: var(--success-rgb); --_fg: var(--success-fg); }
.callout--warn { --_c: var(--warn-rgb); --_fg: var(--warn-fg); }
.callout--danger { --_c: var(--danger-rgb); --_fg: var(--danger-fg); }
.callout--legal { --_c: var(--violet-rgb); --_fg: var(--violet-fg); }
.callout__icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 24px;
  color: var(--_fg);
  flex-shrink: 0;
}
.callout__icon svg {
  width: 19px;
  height: 19px;
}
.callout__content {
  flex: 1 1 auto;
  min-width: 0;
}
.callout__title {
  color: var(--text-1);
  font-weight: var(--fw-semibold);
  line-height: 1.7;
}
.callout__tag {
  display: inline-block;
  margin-right: var(--sp-2);
  padding: 1px var(--sp-1-5);
  border: 1px solid rgb(var(--_c) / 0.5);
  border-radius: var(--r-xs);
  color: var(--_fg);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.5;
  vertical-align: 1px;
}
.callout__body {
  font-size: var(--fs-md);
  line-height: var(--lh-body);
}
.callout__body a:not(.btn) {
  color: var(--_fg);
  text-decoration: underline;
}
.callout__body ul {
  list-style: disc;
  padding-left: 1.3em;
}
.callout__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  align-self: center;
  flex-shrink: 0;
}
.callout--compact {
  padding-top: var(--sp-2);
  padding-bottom: var(--sp-2);
  font-size: var(--fs-sm);
}
.callout--compact .callout__body {
  font-size: var(--fs-sm);
}

/* ==========================================================================
   16 フォームレイアウト
   .form > .form__grid(.form__grid--2|--3) > .field(.field--span-2)
   .field > .field__label(+ .field__required「必須」/ .field__optional「任意」) + 入力 + .field__help + .field__error
   横並びの設定行: .field.field--row
   ========================================================================== */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  min-width: 0;
}
.form__grid {
  display: grid;
  grid-template-columns: repeat(var(--form-cols, 1), minmax(0, 1fr));
  gap: var(--sp-4);
  min-width: 0;
}
.form__grid--2 { --form-cols: 2; }
.form__grid--3 { --form-cols: 3; }
.form__grid--4 { --form-cols: 4; }
@media (max-width: 760px) {
  .form__grid--2,
  .form__grid--3,
  .form__grid--4 {
    --form-cols: 1;
  }
}
.form__section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.form__section-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--line-1);
  color: var(--text-1);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}
.form__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line-1);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1-5);
  min-width: 0;
}
.field--span-2 { grid-column: span 2; }
.field--span-3 { grid-column: span 3; }
.field--span-all { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .field--span-2,
  .field--span-3 {
    grid-column: auto;
  }
}
.field__label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.5;
}
.field__required,
.field__optional {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 var(--sp-1-5);
  border-radius: var(--r-xs);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  line-height: 1;
  flex-shrink: 0;
}
.field__required {
  background-color: var(--danger-soft);
  color: var(--danger-fg);
  border: 1px solid var(--danger-line);
}
.field__optional {
  background-color: var(--neutral-soft);
  color: var(--text-3);
  border: 1px solid var(--line-2);
}
.field__help {
  color: var(--text-3);
  font-size: var(--fs-sm);
  line-height: 1.55;
}
.field__error {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-1-5);
  color: var(--danger-fg);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.55;
}
.field__error svg {
  width: 15px;
  height: 15px;
  margin-top: 2px;
}
.field.is-invalid .input,
.field.is-invalid .select,
.field.is-invalid .textarea,
.field.is-invalid .input-group {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.field.is-invalid .input-group > .input {
  box-shadow: none;
}
.field--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4) var(--sp-6);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line-1);
}
.field--row:last-child {
  border-bottom: 0;
}
.field--row > .field__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.field--row .field__label {
  color: var(--text-1);
  font-size: var(--fs-md);
}
.field--row > .field__control {
  flex: 0 0 auto;
  width: min(100%, var(--field-control-w, 300px));
  display: flex;
  justify-content: flex-end;
}
@media (max-width: 760px) {
  .field--row {
    flex-direction: column;
    align-items: stretch;
  }
  .field--row > .field__control {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ==========================================================================
   17 ステッパー / タイムライン / チェックリスト
   ========================================================================== */
/* ステッパー: .stepper > .stepper__step(.is-done | .is-current) > .stepper__marker + .stepper__label */
.stepper {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  counter-reset: step;
}
.stepper__step {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  text-align: center;
  counter-increment: step;
}
.stepper__step::before {
  content: "";
  position: absolute;
  top: 15px;
  left: calc(-50% + 20px);
  right: calc(50% + 20px);
  height: 2px;
  border-radius: var(--r-pill);
  background-color: var(--line-2);
}
.stepper__step:first-child::before {
  display: none;
}
.stepper__marker {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--line-3);
  border-radius: 50%;
  background-color: var(--surface-solid);
  color: var(--text-3);
  font-family: var(--font-num);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}
.stepper__marker:empty::before {
  content: counter(step);
}
.stepper__marker svg {
  width: 16px;
  height: 16px;
}
.stepper__label {
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.45;
}
.stepper__desc {
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.stepper__step.is-done::before,
.stepper__step.is-current::before {
  background-image: var(--accent-grad);
}
.stepper__step.is-done .stepper__marker {
  border-color: transparent;
  background-image: var(--accent-grad);
  color: var(--text-on-accent);
}
.stepper__step.is-done .stepper__label {
  color: var(--text-2);
}
.stepper__step.is-current .stepper__marker {
  border-color: var(--accent);
  color: var(--accent-fg);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--glow-dot);
}
.stepper__step.is-current .stepper__label {
  color: var(--text-1);
  font-weight: var(--fw-semibold);
}
.stepper--vertical {
  flex-direction: column;
  gap: var(--sp-5);
}
.stepper--vertical .stepper__step {
  flex-direction: row;
  align-items: flex-start;
  gap: var(--sp-3);
  text-align: left;
}
.stepper--vertical .stepper__step::before {
  top: calc(-1 * var(--sp-5) - 0px);
  bottom: calc(100% - 0px);
  left: 15px;
  right: auto;
  width: 2px;
  height: var(--sp-5);
}
.stepper--vertical .stepper__label {
  padding-top: var(--sp-1-5);
}

/* タイムライン: .timeline > .timeline__item(.timeline__item--success|warn|danger|accent) */
.timeline {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.timeline__item {
  --_c: var(--neutral);
  position: relative;
  display: flex;
  gap: var(--sp-3);
  padding-bottom: var(--sp-4);
  min-width: 0;
}
.timeline__item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 16px;
  bottom: -4px;
  width: 1px;
  background-color: var(--line-2);
}
.timeline__item:last-child {
  padding-bottom: 0;
}
.timeline__item:last-child::before {
  display: none;
}
.timeline__dot {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  margin-top: 6px;
  border: 2px solid var(--_c);
  border-radius: 50%;
  background-color: var(--surface-solid);
  flex-shrink: 0;
}
.timeline__item--accent { --_c: var(--accent); }
.timeline__item--success { --_c: var(--success); }
.timeline__item--warn { --_c: var(--warn); }
.timeline__item--danger { --_c: var(--danger); }
.timeline__item--violet { --_c: var(--violet); }
.timeline__item--accent .timeline__dot,
.timeline__item--success .timeline__dot,
.timeline__item--warn .timeline__dot,
.timeline__item--danger .timeline__dot,
.timeline__item--violet .timeline__dot {
  background-color: var(--_c);
  box-shadow: 0 0 8px var(--_c);
}
.timeline__content {
  flex: 1 1 auto;
  min-width: 0;
}
.timeline__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
}
.timeline__title {
  color: var(--text-1);
  font-weight: var(--fw-medium);
  line-height: 1.6;
}
.timeline__time {
  color: var(--text-3);
  font-family: var(--font-num);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.timeline__body {
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

/* チェックリスト: .checklist > .checklist__item(.is-done) > .checklist__mark + .checklist__text */
.checklist {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
}
.checklist__item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  background-color: var(--surface-2);
  min-width: 0;
  transition:
    border-color var(--dur-2) var(--ease-out),
    background-color var(--dur-2) var(--ease-out);
}
label.checklist__item,
button.checklist__item {
  cursor: pointer;
  text-align: left;
  width: 100%;
}
label.checklist__item:hover,
button.checklist__item:hover {
  border-color: var(--line-3);
}
.checklist__item > input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.checklist__mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 1.5px solid var(--line-3);
  border-radius: 50%;
  color: transparent;
  flex-shrink: 0;
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out);
}
.checklist__mark svg {
  width: 13px;
  height: 13px;
}
.checklist__text {
  flex: 1 1 auto;
  min-width: 0;
}
.checklist__title {
  color: var(--text-1);
  font-weight: var(--fw-medium);
  line-height: 1.55;
}
.checklist__desc {
  color: var(--text-3);
  font-size: var(--fs-sm);
  line-height: 1.55;
}
.checklist__item.is-done,
.checklist__item:has(> input:checked) {
  border-color: var(--success-line);
  background-color: var(--success-soft);
}
.checklist__item.is-done .checklist__mark,
.checklist__item:has(> input:checked) .checklist__mark {
  border-color: transparent;
  background-color: var(--success);
  color: var(--text-on-solid);
}
.checklist__item.is-done .checklist__title,
.checklist__item:has(> input:checked) .checklist__title {
  color: var(--text-2);
}
.checklist__item:has(> input:focus-visible) {
  box-shadow: var(--ring);
}

/* ==========================================================================
   18 チャート共通 / ファネル
   色の割り当て: 要素に data-series="1..8|other" か .series-N を付けると --series が決まる。
   文字は必ず文字色トークン（系列色で文字を塗らない）。2系列以上は凡例を付ける。
   ========================================================================== */
.chart {
  position: relative;
  width: 100%;
  min-width: 0;
}
.chart__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.series-1, [data-series="1"] { --series: var(--chart-1); --series-rgb: var(--chart-1-rgb); }
.series-2, [data-series="2"] { --series: var(--chart-2); --series-rgb: var(--chart-2-rgb); }
.series-3, [data-series="3"] { --series: var(--chart-3); --series-rgb: var(--chart-3-rgb); }
.series-4, [data-series="4"] { --series: var(--chart-4); --series-rgb: var(--chart-4-rgb); }
.series-5, [data-series="5"] { --series: var(--chart-5); --series-rgb: var(--chart-5-rgb); }
.series-6, [data-series="6"] { --series: var(--chart-6); --series-rgb: var(--chart-6-rgb); }
.series-7, [data-series="7"] { --series: var(--chart-7); --series-rgb: var(--chart-7-rgb); }
.series-8, [data-series="8"] { --series: var(--chart-8); --series-rgb: var(--chart-8-rgb); }
.series-other, [data-series="other"] { --series: var(--chart-other); --series-rgb: var(--chart-other-rgb); }

.chart__grid,
.chart-grid line {
  stroke: var(--chart-grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}
.chart__axis,
.chart-axis line,
.chart-axis path {
  stroke: var(--chart-axis);
  stroke-width: 1;
  fill: none;
  shape-rendering: crispEdges;
}
.chart__tick,
.chart-axis text {
  fill: var(--chart-label);
  font-family: var(--font-num);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.chart__line {
  fill: none;
  stroke: var(--series, var(--chart-1));
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart__area {
  fill: var(--series, var(--chart-1));
  fill-opacity: var(--chart-area-alpha);
  stroke: none;
}
.chart__bar {
  fill: var(--series, var(--chart-1));
  transition: opacity var(--dur-2) var(--ease-out);
}
.chart__bar.is-dim,
.chart__line.is-dim,
.chart__area.is-dim {
  opacity: 0.3;
}
.chart__dot {
  fill: var(--series, var(--chart-1));
  stroke: var(--chart-surface);
  stroke-width: 2;
}
.chart__crosshair {
  stroke: var(--line-3);
  stroke-width: 1;
  shape-rendering: crispEdges;
}
.chart__label {
  fill: var(--text-2);
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 600;
}
.chart__target {
  stroke: var(--text-3);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}
.chart__donut-track {
  fill: none;
  stroke: var(--line-1);
}
.chart__donut-seg {
  fill: none;
  stroke: var(--series, var(--chart-1));
}
.chart__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1-5) var(--sp-4);
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1-5);
  min-height: 24px;
  color: inherit;
  font: inherit;
  white-space: nowrap;
}
button.chart-legend__item {
  cursor: pointer;
  border-radius: var(--r-sm);
  padding: 0 var(--sp-1);
}
button.chart-legend__item:hover {
  color: var(--text-1);
}
.chart-legend__item[aria-pressed="false"] {
  opacity: 0.45;
}
.chart-legend__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background-color: var(--series, var(--chart-1));
  flex-shrink: 0;
}
.chart-legend__swatch--line {
  width: 14px;
  height: 3px;
  border-radius: var(--r-pill);
}
.chart-legend__value {
  margin-left: var(--sp-1);
  color: var(--text-1);
  font-family: var(--font-num);
  font-weight: var(--fw-semibold);
}

.chart-tooltip {
  position: absolute;
  z-index: var(--z-sticky);
  min-width: 148px;
  padding: var(--sp-2) var(--sp-2-5);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background-color: var(--surface-solid-2);
  box-shadow: var(--shadow-pop);
  color: var(--text-1);
  font-size: var(--fs-sm);
  line-height: 1.5;
  pointer-events: none;
  white-space: nowrap;
}
.chart-tooltip__title {
  margin-bottom: var(--sp-1);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-family: var(--font-num);
}
.chart-tooltip__row {
  display: flex;
  align-items: center;
  gap: var(--sp-1-5);
}
.chart-tooltip__value {
  margin-left: auto;
  padding-left: var(--sp-3);
  font-family: var(--font-num);
  font-weight: var(--fw-semibold);
}
.chart__empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.chart-table-toggle {
  color: var(--text-3);
  font-size: var(--fs-xs);
}

/* スパークライン */
.sparkline {
  display: block;
  overflow: visible;
}
.sparkline__line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.sparkline__area {
  fill: currentColor;
  fill-opacity: 0.14;
  stroke: none;
}
.sparkline__dot {
  fill: currentColor;
  stroke: var(--chart-surface);
  stroke-width: 1.5;
}

/* ファネル（順序のある段階 → 1色相の明度段階）
   .funnel > .funnel__stage[data-step="1..5"][style="--w: 62%"] */
.funnel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-width: 0;
}
.funnel__stage {
  --_c: var(--ordinal-1);
  display: grid;
  grid-template-columns: minmax(72px, 0.9fr) minmax(0, 3fr) minmax(64px, auto);
  align-items: center;
  gap: var(--sp-3);
  min-height: 36px;
}
.funnel__stage[data-step="2"] { --_c: var(--ordinal-2); }
.funnel__stage[data-step="3"] { --_c: var(--ordinal-3); }
.funnel__stage[data-step="4"] { --_c: var(--ordinal-4); }
.funnel__stage[data-step="5"] { --_c: var(--ordinal-5); }
.funnel__label {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}
.funnel__track {
  position: relative;
  height: 22px;
  min-width: 0;
}
.funnel__bar {
  width: var(--w, 0%);
  min-width: 4px;
  height: 100%;
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  background-color: var(--_c);
  transition: width 500ms var(--ease-out);
}
.funnel__value {
  color: var(--text-1);
  font-family: var(--font-num);
  font-weight: var(--fw-semibold);
  text-align: right;
  white-space: nowrap;
}
.funnel__value small {
  margin-left: 2px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}
.funnel__rate {
  grid-column: 2 / 3;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  margin: -2px 0;
  color: var(--text-3);
  font-family: var(--font-num);
  font-size: var(--fs-xs);
}
.funnel__rate svg {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   19 サムネイル / その他
   ========================================================================== */
/* 商品サムネイル枠。画像なしは .thumb--empty（アイコンを中に置く） */
.thumb {
  --thumb-size: 48px;
  position: relative;
  display: grid;
  place-items: center;
  width: var(--thumb-size);
  height: var(--thumb-size);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background-color: var(--thumb-img-bg);
  overflow: hidden;
  flex-shrink: 0;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.thumb--sm { --thumb-size: 36px; border-radius: var(--r-sm); }
.thumb--lg { --thumb-size: 72px; border-radius: var(--r-lg); }
.thumb--xl { --thumb-size: 120px; border-radius: var(--r-xl); }
.thumb--empty {
  background-color: transparent;
  background-image: var(--thumb-bg);
  color: var(--text-3);
}
.thumb--empty svg {
  width: 46%;
  height: 46%;
  opacity: 0.9;
}
/* 画像なしの枠にだけ、HUDの角 */
.thumb--empty::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid var(--accent-line);
  border-radius: calc(var(--r-md) - 3px);
  opacity: 0.55;
  pointer-events: none;
  --_s: 6px;
  -webkit-mask:
    linear-gradient(black, black) top left / var(--_s) var(--_s) no-repeat,
    linear-gradient(black, black) top right / var(--_s) var(--_s) no-repeat,
    linear-gradient(black, black) bottom left / var(--_s) var(--_s) no-repeat,
    linear-gradient(black, black) bottom right / var(--_s) var(--_s) no-repeat;
  mask:
    linear-gradient(black, black) top left / var(--_s) var(--_s) no-repeat,
    linear-gradient(black, black) top right / var(--_s) var(--_s) no-repeat,
    linear-gradient(black, black) bottom left / var(--_s) var(--_s) no-repeat,
    linear-gradient(black, black) bottom right / var(--_s) var(--_s) no-repeat;
}

/* アイコンの丸タイル（リストの先頭など） */
.icon-tile {
  --_c: var(--accent-rgb);
  --_fg: var(--accent-fg);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-lg);
  background-color: rgb(var(--_c) / 0.14);
  color: var(--_fg);
  flex-shrink: 0;
}
.icon-tile svg {
  width: 18px;
  height: 18px;
}
.icon-tile--sm {
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
}
.icon-tile--sm svg {
  width: 15px;
  height: 15px;
}
.icon-tile--violet { --_c: var(--violet-rgb); --_fg: var(--violet-fg); }
.icon-tile--success { --_c: var(--success-rgb); --_fg: var(--success-fg); }
.icon-tile--warn { --_c: var(--warn-rgb); --_fg: var(--warn-fg); }
.icon-tile--danger { --_c: var(--danger-rgb); --_fg: var(--danger-fg); }
.icon-tile--info { --_c: var(--info-rgb); --_fg: var(--info-fg); }
.icon-tile--neutral { --_c: var(--neutral-rgb); --_fg: var(--text-2); }

/* 行リスト（通知・ジョブ・検索結果などの汎用の行） */
.list {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.list__item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--r-lg);
  min-width: 0;
  transition: background-color var(--dur-1) var(--ease-out);
}
.list__item + .list__item {
  margin-top: 2px;
}
.list--divided .list__item {
  border-radius: 0;
  border-bottom: 1px solid var(--line-1);
}
.list--divided .list__item:last-child {
  border-bottom: 0;
}
a.list__item,
button.list__item,
.list__item.is-clickable {
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
  text-decoration: none;
}
a.list__item:hover,
button.list__item:hover,
.list__item.is-clickable:hover {
  background-color: var(--neutral-soft);
}
.list__body {
  flex: 1 1 auto;
  min-width: 0;
}
.list__title {
  color: var(--text-1);
  font-weight: var(--fw-medium);
  line-height: 1.55;
}
.list__desc {
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.55;
}
.list__meta {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-family: var(--font-num);
  white-space: nowrap;
}
.list__aside {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-shrink: 0;
}

/* 外部リンク（必ず target="_blank" rel="noopener noreferrer" と一緒に） */
.ext-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}
.ext-link svg {
  width: 0.95em;
  height: 0.95em;
  opacity: 0.8;
}


/* 表の優先度（ui.dataTable の priority）: 枠に収まらない列は JS が is-col-hidden を付けて隠す */
.table .is-col-hidden {
  display: none;
}
.table-note {
  margin: 0;
  padding: var(--sp-2) var(--sp-4);
  color: var(--text-3);
  font-size: var(--fs-xs);
  border-top: 1px solid var(--line-1);
}
.table-note[hidden] {
  display: none;
}

/* 行の操作ボタン列: 中身の幅に合わせる（ボタンがセルからはみ出して横スクロールを作らない） */
.table td.table__cell-actions,
.table th.table__cell-actions {
  width: 1%;
  white-space: nowrap;
}

/* 小さい切替ボタンも、見た目は変えずに当たり判定を36px以上にする（AC-055） */
.segmented--sm .segmented__item { position: relative; }
.segmented--sm .segmented__item::before {
  content: "";
  position: absolute;
  inset: -4px 0;
}
