/* Hallmark · redesign · theme: custom "Night Console"（夜間運用コンソール）
 * genre: utilitarian-technical · scope: design-system stylesheet (admin PWA · dark · mobile-first)
 * paper: oklch(16% 0.008 260) · accent: oklch(60% 0.14 252) cobalt · axes: dark / system-grotesk / cool-blue
 * type: JP system sans display (W700-800, tight tracking) + JP system sans body (W400)
 *       + system mono for data labels & numerals (2+1 role pairing, tabular-nums)
 * spacing: 4pt named scale · radii: card 8 / button 7 / chip 5 (no pills)
 * motion: transform + opacity only · --hm-ease-out · prefers-reduced-motion supported
 * states: default · hover(@hover:hover) · :focus-visible(instant ring) · :active · :disabled
 * pre-emit critique: P4 H5 E5 S4 R5 V4
 * contrast: pass (40-41; accent link 4.5:1+/paper · primary-btn text 7.5:1 · grade tiles 4.9-7.8:1)
 * tokens: pass (48, this file) · mobile: pass (34, 49, 50-51; grids minmax(0,1fr))
 * NOTE: すべての既存セレクタ・変数名を維持。プロパティ値と追加ルールのみで刷新。
 */

:root {
  /* --- surfaces & ink (dark · cool anchor hue 250-260) --- */
  --hm-page: oklch(16% 0.008 260);        /* ≈#0b0d11 */
  --hm-surface: oklch(20% 0.01 260);      /* ≈#13161b */
  --hm-surface-2: oklch(24% 0.012 260);   /* ≈#1c1f25 */
  --hm-surface-3: oklch(28.5% 0.013 260); /* hover elevation (dark = lighter) */
  --hm-ink: oklch(93% 0.006 250);         /* ≈#e5e8ec — not pure white */
  --hm-ink-2: oklch(78% 0.01 250);        /* ≈#b3b8be */
  --hm-ink-mute: oklch(64% 0.012 255);    /* ≈#878d94 · 4.8:1+ on surface-2 */
  --hm-hairline: oklch(28% 0.012 260);
  --hm-border: oklch(88% 0.012 255 / 0.13);
  --hm-border-strong: oklch(88% 0.012 255 / 0.30);

  /* --- accent & series (CVD配慮: 青/青緑/琥珀/薄紫/ローズ · 明度も分離) --- */
  --hm-accent: oklch(60% 0.14 252);       /* cobalt · text 4.5:1+/page */
  --hm-accent-deep: oklch(40% 0.12 252);  /* primary fill · ink text 7.5:1 */
  --hm-accent-deep-2: oklch(45% 0.125 252); /* primary hover */
  --hm-accent-ink: oklch(16% 0.008 260);  /* text on chromatic fills */
  --hm-focus: oklch(78% 0.11 250);        /* ring · 8:1+/page, 3:1+ everywhere */
  --hm-aqua:   oklch(68% 0.105 175);
  --hm-amber:  oklch(72% 0.125 75);
  --hm-violet: oklch(72% 0.095 290);
  --hm-rose:   oklch(68% 0.115 15);

  /* --- status (text on dark: all 6:1+) --- */
  --hm-good:     oklch(68% 0.14 150);
  --hm-warning:  oklch(75% 0.135 85);
  --hm-serious:  oklch(70% 0.13 45);
  --hm-critical: oklch(62% 0.17 25);

  /* --- grade mapping (bright fill + dark letter: 4.9-7.8:1) --- */
  --hm-grade-s: var(--hm-accent);
  --hm-grade-a: var(--hm-aqua);
  --hm-grade-b: var(--hm-amber);
  --hm-grade-c: oklch(60% 0.012 260);

  /* --- geometry (角丸は控えめ: ピル禁止) --- */
  --hm-radius: 8px;        /* card / panel */
  --hm-radius-btn: 7px;    /* button */
  --hm-radius-sm: 5px;     /* chip / status */

  /* --- 4pt spacing scale --- */
  --hm-space-1: 4px;
  --hm-space-2: 8px;
  --hm-space-3: 12px;
  --hm-space-4: 16px;
  --hm-space-5: 20px;
  --hm-space-6: 24px;
  --hm-space-8: 32px;
  --hm-space-12: 48px;

  /* --- type scale (dense admin · ~1.16 step) & roles --- */
  --hm-text-2xs: 11px;   /* mono labels only */
  --hm-text-xs: 12px;
  --hm-text-sm: 13px;
  --hm-text-base: 15px;
  --hm-text-md: 17px;
  --hm-text-lg: 19px;
  --hm-text-2xl: 27px;   /* KPI figures */
  --hm-track-label: 0.08em;
  --hm-track-tight: -0.01em;
  --hm-font: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI",
             system-ui, -apple-system, "Segoe UI", sans-serif;
  --hm-font-display: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI",
             system-ui, -apple-system, "Segoe UI", sans-serif;
  --hm-font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono",
             "Roboto Mono", Menlo, Consolas, monospace;

  /* --- motion (transform/opacity系のみ · バウンス禁止) --- */
  --hm-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --hm-ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --hm-dur-fast: 100ms;
  --hm-dur-short: 160ms;

  --hm-shadow: 0 2px 6px oklch(0% 0 0 / 0.35), 0 12px 32px oklch(0% 0 0 / 0.28);
}

/* ---------- reset & base ---------- */
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}
body {
  margin: 0;
  overflow-x: clip;
  background: var(--hm-page);
  color: var(--hm-ink);
  font-family: var(--hm-font);
  font-size: var(--hm-text-base);
  line-height: 1.65;
  font-feature-settings: "palt";
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
code {
  font-family: var(--hm-font-mono);
  font-size: 0.92em;
  background: var(--hm-surface-2);
  border: 1px solid var(--hm-hairline);
  border-radius: 4px;
  padding: 1px 5px;
}
::selection { background: var(--hm-accent-deep); color: var(--hm-ink); }

/* focus: 全インタラクティブ要素に即時リング（アニメーション禁止・3:1以上） */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* インラインの文中リンク（アクセント色）は hover で下線 */
@media (hover: hover) {
  .hm-panel a:not(.hm-btn):hover,
  .hm-detail-head a:hover,
  .hm-empty a:hover,
  .hm-card .meta a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
  }
}

/* ---------- header ---------- */
.hm-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--hm-space-2);
  padding: calc(var(--hm-space-3) + env(safe-area-inset-top)) var(--hm-space-4) var(--hm-space-3);
  background: color-mix(in oklab, var(--hm-page) 84%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hm-hairline);
}
.hm-header .brand {
  font-family: var(--hm-font-display);
  font-weight: 800; font-size: 16px;
  letter-spacing: var(--hm-track-tight);
  line-height: 1.2;
}
.hm-header .brand small {
  display: block;
  font-family: var(--hm-font-mono);
  font-size: 10px; font-weight: 500;
  color: var(--hm-ink-mute);
  letter-spacing: 0.18em;
  margin-top: 2px;
}
.hm-header .spacer { flex: 1; }

.hm-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--hm-font-mono);
  font-size: var(--hm-text-2xs); font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--hm-ink-2);
  border: 1px solid var(--hm-border);
  background: var(--hm-surface);
  padding: var(--hm-space-1) 10px;
  border-radius: var(--hm-radius-sm);
  line-height: 1.5;
}
.hm-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.hm-dot.on  { background: var(--hm-good); }
.hm-dot.off { background: var(--hm-ink-mute); }

/* ---------- layout ---------- */
.hm-container {
  padding: var(--hm-space-4) var(--hm-space-4) var(--hm-space-6);
  max-width: 1080px; margin: 0 auto;
}
.hm-section-title {
  font-family: var(--hm-font-display);
  font-size: var(--hm-text-xs); font-weight: 700;
  letter-spacing: var(--hm-track-label);
  color: var(--hm-ink-mute);
  margin: var(--hm-space-6) var(--hm-space-1) var(--hm-space-2);
  display: flex; align-items: center; gap: 7px;
}
.hm-section-title::before {
  content: "";
  width: 5px; height: 5px; flex: none;
  background: var(--hm-accent);
  border-radius: 1px;
}

/* ---------- KPI stat tiles ---------- */
.hm-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--hm-space-2);
}
@media (min-width: 720px) { .hm-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hm-kpi {
  background: var(--hm-surface);
  border: 1px solid var(--hm-hairline);
  border-radius: var(--hm-radius);
  padding: var(--hm-space-3) var(--hm-space-4);
  min-width: 0;
}
.hm-kpi .label {
  font-family: var(--hm-font-mono);
  font-size: var(--hm-text-2xs);
  color: var(--hm-ink-mute);
  letter-spacing: 0.05em;
}
.hm-kpi .value {
  font-family: var(--hm-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--hm-text-2xl); font-weight: 700;
  letter-spacing: var(--hm-track-tight);
  line-height: 1.25; margin-top: 2px;
  overflow-wrap: anywhere;
}
.hm-kpi .value small {
  font-family: var(--hm-font);
  font-size: var(--hm-text-sm); font-weight: 600;
  color: var(--hm-ink-2); margin-left: 2px;
}
.hm-kpi .sub {
  font-size: var(--hm-text-2xs);
  color: var(--hm-ink-mute);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* ---------- cards ---------- */
.hm-card {
  display: block;
  background: var(--hm-surface);
  border: 1px solid var(--hm-border);
  border-radius: var(--hm-radius);
  padding: var(--hm-space-3) var(--hm-space-4);
  margin-bottom: var(--hm-space-2);
  transition: border-color var(--hm-dur-short) var(--hm-ease-out),
              transform var(--hm-dur-fast) var(--hm-ease-out);
}
.hm-card:active { transform: scale(0.995); }
@media (hover: hover) {
  .hm-card:hover { border-color: var(--hm-border-strong); }
}
.hm-card .row1 { display: flex; align-items: flex-start; gap: var(--hm-space-2); }
.hm-card .title {
  font-family: var(--hm-font-display);
  font-weight: 600; font-size: 14.5px; line-height: 1.5; flex: 1;
  min-width: 0; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hm-card .meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  margin-top: var(--hm-space-2);
  font-size: var(--hm-text-xs); color: var(--hm-ink-2);
  font-variant-numeric: tabular-nums;
}
.hm-card .reason {
  margin-top: var(--hm-space-2);
  font-size: var(--hm-text-xs); line-height: 1.6;
  color: var(--hm-ink-mute);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- badges & chips ---------- */
.hm-grade {
  flex: none; width: 34px; height: 34px;
  border-radius: 6px;
  display: grid; place-items: center;
  font-family: var(--hm-font-mono);
  font-weight: 800; font-size: 16px;
  color: var(--hm-accent-ink); /* 明フィル×濃インク: 全グレード4.9:1以上 */
}
.hm-grade.g-S { background: var(--hm-grade-s); }
.hm-grade.g-A { background: var(--hm-grade-a); }
.hm-grade.g-B { background: var(--hm-grade-b); }
.hm-grade.g-C { background: var(--hm-grade-c); }
.hm-grade.g- {
  background: var(--hm-surface-2);
  border: 1px dashed var(--hm-hairline);
  color: var(--hm-ink-mute);
  font-family: var(--hm-font);
  font-size: var(--hm-text-2xs); font-weight: 600;
}

.hm-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--hm-text-2xs); font-weight: 600;
  line-height: 1.6;
  padding: 3px 9px;
  border-radius: var(--hm-radius-sm);
  background: var(--hm-surface-2); color: var(--hm-ink-2);
  border: 1px solid var(--hm-hairline);
}
.hm-chip .n {
  font-family: var(--hm-font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--hm-ink);
}
/* アクティブフィルタ（テンプレ側でaccent塗り+白文字が指定される）: 太らせて視認性を担保 */
.hm-chip[style*="--hm-accent"] { font-weight: 700; }
.hm-chip[style*="--hm-accent"] .n { color: inherit; }
.hm-chip.cat-hp  { color: var(--hm-violet); }
.hm-chip.cat-gas { color: var(--hm-aqua); }
.hm-chip.risk {
  color: var(--hm-serious);
  border-color: color-mix(in oklab, var(--hm-serious) 40%, transparent);
}

.hm-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--hm-text-2xs); font-weight: 700;
  letter-spacing: 0.04em; line-height: 1.6;
  padding: 3px 10px;
  border-radius: var(--hm-radius-sm);
  border: 1px solid var(--hm-border); color: var(--hm-ink-2);
}
.hm-status::before {
  content: ""; width: 6px; height: 6px; flex: none;
  border-radius: 50%; background: currentColor;
}
.hm-status.st-new         { color: var(--hm-ink-2); }
.hm-status.st-reviewed    { color: var(--hm-accent); }
.hm-status.st-proposed    { color: var(--hm-violet); }
.hm-status.st-won         { color: var(--hm-good); }
.hm-status.st-hearing     { color: var(--hm-aqua); }
.hm-status.st-production  { color: var(--hm-amber); }
.hm-status.st-review_wait { color: var(--hm-serious); }
.hm-status.st-delivered   { color: var(--hm-good); }
.hm-status.st-closed      { color: var(--hm-ink-mute); }

/* ---------- grade distribution bar ---------- */
.hm-dist {
  display: flex; gap: 2px;
  border-radius: 3px; overflow: hidden;
  height: 10px; margin: 6px 0 var(--hm-space-1);
}
.hm-dist span { display: block; }
.hm-dist .d-S { background: var(--hm-grade-s); }
.hm-dist .d-A { background: var(--hm-grade-a); }
.hm-dist .d-B { background: var(--hm-grade-b); }
.hm-dist .d-C { background: var(--hm-grade-c); }
.hm-dist-legend {
  display: flex; gap: 14px;
  font-family: var(--hm-font-mono);
  font-size: var(--hm-text-2xs);
  font-variant-numeric: tabular-nums;
  color: var(--hm-ink-mute);
}
.hm-dist-legend i {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 2px; margin-right: var(--hm-space-1);
}

/* ---------- buttons ---------- */
.hm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--hm-border);
  background: var(--hm-surface-2); color: var(--hm-ink);
  font-family: var(--hm-font-display);
  font-size: 13.5px; font-weight: 600;
  line-height: 1.4; /* nowrapは不採用: テンプレ側に長い日本語ラベルがあり320pxでは折返しが可読性で勝る */
  padding: 10px var(--hm-space-4);
  border-radius: var(--hm-radius-btn);
  cursor: pointer;
  min-height: 44px; /* touch target floor */
  transition: background-color var(--hm-dur-short) var(--hm-ease-out),
              border-color var(--hm-dur-short) var(--hm-ease-out),
              transform var(--hm-dur-fast) var(--hm-ease-out);
}
@media (hover: hover) {
  .hm-btn:hover:not(:disabled) { background: var(--hm-surface-3); }
}
.hm-btn:active:not(:disabled) { transform: translateY(1px); }
.hm-btn:focus-visible { outline: 2px solid var(--hm-focus); outline-offset: 2px; }
.hm-btn.primary {
  background: var(--hm-accent-deep);
  border-color: color-mix(in oklab, var(--hm-accent) 45%, transparent);
  color: var(--hm-ink);
}
@media (hover: hover) {
  .hm-btn.primary:hover:not(:disabled) { background: var(--hm-accent-deep-2); }
}
.hm-btn.ghost { background: transparent; }
@media (hover: hover) {
  .hm-btn.ghost:hover:not(:disabled) { background: var(--hm-surface-2); }
}
.hm-btn.block { width: 100%; }
.hm-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.hm-btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }

/* ---------- forms ---------- */
.hm-field { margin-bottom: var(--hm-space-4); }
.hm-field label {
  display: block;
  font-size: var(--hm-text-xs); font-weight: 600;
  color: var(--hm-ink-mute);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
.hm-input, .hm-select, .hm-textarea {
  width: 100%;
  background: var(--hm-surface-2);
  border: 1px solid var(--hm-border); /* 全状態で1px固定（レイアウトシフト禁止） */
  color: var(--hm-ink);
  border-radius: 6px;
  padding: 10px var(--hm-space-3);
  font-size: var(--hm-text-base);
  font-family: inherit;
  line-height: 1.55;
  min-height: 44px; /* ボタンと同一の基準高 */
  outline: 2px solid transparent; /* リング用スロットを予約 */
  outline-offset: 1px;
  transition: background-color var(--hm-dur-short) var(--hm-ease-out),
              border-color var(--hm-dur-short) var(--hm-ease-out);
}
.hm-input::placeholder, .hm-textarea::placeholder { color: var(--hm-ink-mute); }
@media (hover: hover) {
  .hm-input:hover, .hm-select:hover, .hm-textarea:hover { background: var(--hm-surface-3); }
}
.hm-textarea { min-height: 200px; line-height: 1.7; resize: vertical; }
.hm-input:focus, .hm-select:focus, .hm-textarea:focus,
.hm-input:focus-visible, .hm-select:focus-visible, .hm-textarea:focus-visible {
  outline: 2px solid var(--hm-focus);
  outline-offset: 1px;
  border-color: var(--hm-border-strong);
}
.hm-input:disabled, .hm-select:disabled, .hm-textarea:disabled {
  opacity: 0.55; cursor: not-allowed;
}
.hm-input[aria-invalid="true"], .hm-textarea[aria-invalid="true"] {
  border-color: color-mix(in oklab, var(--hm-critical) 60%, transparent);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--hm-accent); }

/* ---------- kanban board ---------- */
.hm-board {
  display: flex; gap: var(--hm-space-3);
  overflow-x: auto;
  padding: var(--hm-space-1) 2px var(--hm-space-4);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.hm-col {
  flex: 0 0 260px; min-width: 0; scroll-snap-align: start;
  background: color-mix(in oklab, var(--hm-surface) 60%, transparent);
  border: 1px solid var(--hm-hairline);
  border-radius: var(--hm-radius);
  padding: 10px;
  max-height: 72vh; overflow-y: auto;
}
.hm-col > header {
  position: sticky; top: -10px; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--hm-space-2) 6px 10px;
  margin: -10px -4px 6px;
  background: var(--hm-surface);
  border-bottom: 1px solid var(--hm-hairline);
  font-family: var(--hm-font-display);
  font-size: 12.5px; font-weight: 700;
  letter-spacing: 0.03em;
}
.hm-col .count {
  font-family: var(--hm-font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--hm-ink-mute); font-weight: 600;
}
.hm-col .hm-card { padding: 11px var(--hm-space-3); margin-bottom: var(--hm-space-2); }
.hm-col .hm-card .title { font-size: var(--hm-text-sm); -webkit-line-clamp: 3; }
.hm-move { display: flex; gap: 6px; margin-top: 10px; }
.hm-move button {
  flex: 1; min-height: 36px;
  border-radius: var(--hm-radius-sm);
  border: 1px solid var(--hm-border);
  background: var(--hm-surface-2);
  color: var(--hm-ink-2);
  font-size: var(--hm-text-xs);
  cursor: pointer;
  transition: background-color var(--hm-dur-short) var(--hm-ease-out),
              transform var(--hm-dur-fast) var(--hm-ease-out);
}
@media (hover: hover) {
  .hm-move button:hover:not(:disabled) { background: var(--hm-surface-3); color: var(--hm-ink); }
}
.hm-move button:active:not(:disabled) { transform: translateY(1px); }
.hm-move button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- detail page ---------- */
.hm-detail-head { padding: var(--hm-space-1) 2px 0; }
.hm-detail-head h1 {
  font-family: var(--hm-font-display);
  font-size: var(--hm-text-lg); font-weight: 700;
  letter-spacing: var(--hm-track-tight);
  line-height: 1.45;
  overflow-wrap: anywhere; min-width: 0;
  margin: var(--hm-space-2) 0 10px;
}
.hm-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--hm-space-2);
  margin: var(--hm-space-4) 0;
}
@media (min-width: 720px) { .hm-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hm-fact {
  background: var(--hm-surface);
  border: 1px solid var(--hm-hairline);
  border-radius: var(--hm-radius-sm);
  padding: 10px var(--hm-space-3);
  min-width: 0;
}
.hm-fact .k {
  font-family: var(--hm-font-mono);
  font-size: 10.5px;
  color: var(--hm-ink-mute);
  letter-spacing: 0.06em;
}
.hm-fact .v {
  font-size: 13.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  margin-top: 2px;
}

.hm-panel {
  background: var(--hm-surface);
  border: 1px solid var(--hm-hairline);
  border-radius: var(--hm-radius);
  padding: var(--hm-space-4);
  margin-bottom: var(--hm-space-3);
}
.hm-panel h2 {
  font-family: var(--hm-font-display);
  font-size: var(--hm-text-xs);
  letter-spacing: var(--hm-track-label);
  color: var(--hm-ink-mute);
  margin: 0 0 10px; font-weight: 700;
}
.hm-panel .body-text {
  font-size: var(--hm-text-base);
  line-height: 1.8;
  color: var(--hm-ink-2);
  max-width: 42em; /* JPで45-75字相当の読み幅 */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- bottom nav ---------- */
.hm-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: color-mix(in oklab, var(--hm-page) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--hm-hairline);
  padding: var(--hm-space-2) var(--hm-space-2) calc(var(--hm-space-2) + env(safe-area-inset-bottom));
}
.hm-nav a {
  position: relative;
  flex: 1; text-align: center;
  font-size: var(--hm-text-2xs); font-weight: 600;
  white-space: nowrap;
  color: var(--hm-ink-mute);
  padding: 6px 0 2px;
  border-radius: 6px;
  min-height: 44px;
  transition: color var(--hm-dur-short) var(--hm-ease-out);
}
.hm-nav a .ico { display: block; font-size: 19px; line-height: 1.2; }
@media (hover: hover) {
  .hm-nav a:hover { color: var(--hm-ink-2); }
}
.hm-nav a.active { color: var(--hm-accent); font-weight: 700; }
.hm-nav a.active::before {
  /* 色だけに頼らないアクティブ表示（バー併記） */
  content: "";
  position: absolute; top: -8px; left: 50%;
  width: 16px; height: 2px;
  transform: translateX(-50%);
  background: var(--hm-accent);
  border-radius: 0 0 2px 2px;
}
.hm-nav a:focus-visible { outline: 2px solid var(--hm-focus); outline-offset: -2px; }

/* ---------- toast ---------- */
.hm-toast {
  position: fixed; left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: var(--hm-surface-2); color: var(--hm-ink);
  border: 1px solid var(--hm-border);
  padding: 10px 18px;
  border-radius: var(--hm-radius);
  font-size: var(--hm-text-sm); font-weight: 600;
  line-height: 1.5;
  max-width: min(92vw, 480px);
  box-shadow: var(--hm-shadow);
  opacity: 0; pointer-events: none;
  transition: opacity var(--hm-dur-short) var(--hm-ease-out),
              transform var(--hm-dur-short) var(--hm-ease-out);
  z-index: 50;
}
.hm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.hm-toast.err {
  border-color: color-mix(in oklab, var(--hm-critical) 55%, transparent);
  color: var(--hm-ink);
}
.hm-toast.err::before { content: "⚠ "; color: var(--hm-serious); }

.hm-empty {
  text-align: center; color: var(--hm-ink-mute);
  border: 1px dashed var(--hm-hairline);
  border-radius: var(--hm-radius);
  padding: var(--hm-space-12) var(--hm-space-4);
  font-size: var(--hm-text-sm);
  line-height: 1.9;
}

/* ---------- reduced motion: 空間移動はopacityのみ・150ms以下 ---------- */
@media (prefers-reduced-motion: reduce) {
  .hm-card, .hm-btn, .hm-move button, .hm-nav a,
  .hm-input, .hm-select, .hm-textarea {
    transition: none;
  }
  .hm-card:active, .hm-btn:active:not(:disabled), .hm-move button:active:not(:disabled) {
    transform: none;
  }
  .hm-toast {
    transition: opacity 120ms linear;
    transform: translateX(-50%);
  }
  .hm-toast.show { transform: translateX(-50%); }
}
