/* =========================================================================
   Truck Shop JET — Business Operations Design System  v3 "NE-style"
   ds3.css  /  v3.0  /  2026-11-03
   ネクストエンジン風のデザイン言語で再構成したスタディ版。
   ※ Next Engine そのものではなく、NE に慣れた現場のための UI バリアント。
   静的デザインリファレンス（DB・サーバー接続なし）。
   ========================================================================= */

/* ---------- 1. Design tokens -------------------------------------------- */
:root {
  color-scheme: light;

  /* surface */
  --bg: #ebeef2;
  --bg-deep: #e3e8ee;
  --surface: #ffffff;
  --surface-subtle: #f6f8fa;
  --surface-sunken: #eef1f5;
  --surface-hover: #fdf6ea;

  /* border */
  --border: #dde3ea;
  --border-soft: #e9edf2;
  --border-strong: #c3cdd9;

  /* text */
  --text: #1c2532;
  --text-2: #4a5568;
  --text-3: #5b6675;
  --text-inverse: #ffffff;

  /* brand / primary（NE 風オレンジ） */
  --primary: #f08c00;
  --primary-hover: #d97d00;
  --primary-active: #bc6d00;
  --primary-50: #fef4e2;
  --primary-100: #fce7c4;
  --primary-200: #f8d198;
  --primary-ring: rgba(240, 140, 0, 0.2);
  --primary-text: #8f5000;
  --link: #1464b4;
  --link-hover: #0f4f8f;

  /* dark header */
  --header-bg: #232a38;
  --header-bg-2: #1b212c;
  --header-text: #e9edf4;
  --header-muted: #97a2b4;
  --header-line: rgba(255, 255, 255, 0.09);
  --header-hover: rgba(255, 255, 255, 0.07);

  /* semantic */
  --success: #17804b;
  --success-bg: #e8f6ee;
  --success-border: #bfe6cf;
  --warning: #b26a00;
  --warning-bg: #fdf2df;
  --warning-border: #f2d9a8;
  --danger: #c0341d;
  --danger-bg: #fdeee9;
  --danger-border: #f4c8bc;
  --info: #1763c9;
  --info-bg: #ebf3fd;
  --info-border: #c5dbfa;
  --teal: #0d7a8c;
  --teal-bg: #e8f8fa;
  --teal-border: #bdeaf0;
  --neutral-bg: #eff2f6;
  --neutral-border: #dde3ea;

  /* typography */
  --font: "Noto Sans JP", "Noto Sans CJK JP", -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  --fs-2xs: 10.5px;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 14.5px;
  --fs-xl: 17px;
  --fs-2xl: 21px;

  /* radius */
  --r-xs: 3px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 10px;
  --r-full: 999px;

  /* shadow */
  --sh-xs: 0 1px 2px rgba(20, 28, 40, 0.06);
  --sh-sm: 0 1px 2px rgba(20, 28, 40, 0.07), 0 1px 3px rgba(20, 28, 40, 0.09);
  --sh-md: 0 2px 4px -1px rgba(20, 28, 40, 0.06), 0 5px 10px -3px rgba(20, 28, 40, 0.1);
  --sh-lg: 0 4px 8px -2px rgba(20, 28, 40, 0.08), 0 14px 24px -8px rgba(20, 28, 40, 0.16);
  --sh-xl: 0 8px 16px -4px rgba(20, 28, 40, 0.1), 0 24px 44px -12px rgba(20, 28, 40, 0.22);

  /* layout */
  --sidebar-w: 236px;
  --sidebar-w-mini: 60px;
  --header-h: 52px;
  --subbar-h: 40px;

  --z-sticky: 20;
  --z-header: 40;
  --z-dropdown: 60;
  --z-overlay: 80;
  --z-modal: 90;
  --z-toast: 100;

  --focus: 0 0 0 3px var(--surface), 0 0 0 6px var(--primary-ring);
  --dur: 0.13s;
  --ease: cubic-bezier(0.2, 0, 0.2, 1);
}

/* ---------- 2. Base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, dl, dd, dt, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--primary-100); }
[hidden] { display: none !important; }

.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-xs { width: 13px; height: 13px; }
.i-sm { width: 14px; height: 14px; }
.i-lg { width: 18px; height: 18px; }
.i-xl { width: 22px; height: 22px; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap; }
.num, td.t-num, .t-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }

.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 5px;
  font-size: var(--fs-2xs); font-weight: 600; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: var(--r-xs);
}

/* ---------- 3. App shell（NE 風: ダークトップバー＋左メニュー） -------------- */
.app { display: flex; min-height: 100vh; }

/* --- top header（ダーク） --- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: var(--z-header);
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  color: var(--header-text);
  background: linear-gradient(180deg, var(--header-bg), var(--header-bg-2));
  box-shadow: 0 1px 0 var(--header-line), var(--sh-sm);
}
.topbar .brand {
  display: flex; align-items: center; gap: 9px;
  padding-right: 12px; margin-right: 2px;
  border-right: 1px solid var(--header-line);
  color: var(--header-text); white-space: nowrap;
}
.topbar .brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #ffa21f, #e07d00);
  color: #fff; font-weight: 800; font-size: 12px; letter-spacing: 0.03em;
  border-radius: 6px; box-shadow: inset 0 1px 0 rgba(255,255,255,.28);
}
.brand-name { line-height: 1.2; }
.brand-name b { display: block; font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; }
.brand-name span { display: block; font-size: 9px; letter-spacing: 0.14em; color: var(--header-muted); font-weight: 600; }

.h-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; min-width: 34px; padding: 0 9px;
  color: var(--header-text); border-radius: var(--r-md);
  transition: background var(--dur), color var(--dur);
}
.h-btn:hover { background: var(--header-hover); color: #fff; }
.h-btn .dot {
  position: absolute; top: 6px; right: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--header-bg-2);
}
.topbar .global-search {
  display: flex; align-items: center; gap: 8px;
  width: 250px; height: 32px; padding: 0 10px;
  color: var(--header-muted); font-size: var(--fs-sm);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--header-line); border-radius: var(--r-md);
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.topbar .global-search:hover { background: rgba(255,255,255,0.13); color: var(--header-text); border-color: rgba(255,255,255,0.18); }
.topbar .global-search span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .global-search .kbd { margin-left: auto; background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.16); color: var(--header-text); }
.store-chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  height: 32px; padding: 0 10px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--header-text);
  background: rgba(255,255,255,0.06); border: 1px solid var(--header-line);
  border-radius: var(--r-md); white-space: nowrap;
  transition: background var(--dur);
}
.store-chip:hover { background: rgba(255,255,255,0.11); }
.store-chip .scope { font-size: var(--fs-2xs); font-weight: 700; color: #ffd9a0; background: rgba(240,140,0,.22); border-radius: var(--r-xs); padding: 1px 6px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 6px 0 3px; border-radius: var(--r-md);
  color: var(--header-text);
  transition: background var(--dur);
}
.user-chip:hover { background: var(--header-hover); }
.avatar {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #4a5878, #2c3648);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
}
.avatar.lg { width: 38px; height: 38px; font-size: 13px; background: linear-gradient(135deg, #ffa21f, #e07d00); border: 0; }
.user-meta { text-align: left; line-height: 1.2; }
.user-meta b { display: block; font-size: var(--fs-sm); font-weight: 650; white-space: nowrap; }
.user-meta span { display: block; font-size: var(--fs-2xs); color: var(--header-muted); white-space: nowrap; }
.header-divider { width: 1px; height: 22px; background: var(--header-line); }
.topbar .spacer { flex: 1; }

/* --- sub bar（パンくず＋ページ名） --- */
.subbar {
  position: fixed; top: var(--header-h); right: 0; left: var(--sidebar-w); z-index: calc(var(--z-header) - 1);
  height: var(--subbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: left var(--dur) var(--ease);
}
body.is-sidebar-collapsed .subbar { left: var(--sidebar-w-mini); }
.subbar h1 { font-size: var(--fs-xl); font-weight: 750; letter-spacing: 0.01em; white-space: nowrap; }
.crumbs { display: flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--link); }
.crumbs .i { width: 11px; height: 11px; }
.crumbs .sep { color: var(--border-strong); }
.subbar .crumbs { margin-left: 2px; }
.subbar .v-sep { width: 1px; height: 18px; background: var(--border); }

/* --- sidebar（白＋オレンジのアクティブ） --- */
.sidebar {
  position: fixed; inset: var(--header-h) auto 0 0; z-index: calc(var(--z-header) - 1);
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 8px 14px; scrollbar-width: thin; }
.nav-group { margin-top: 10px; }
.nav-group:first-child { margin-top: 0; }
.nav-group-label {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 9px 4px;
  font-size: var(--fs-2xs); font-weight: 750; letter-spacing: 0.06em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-soft);
  margin: 0 2px 4px;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  padding: 6px 9px; margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--text-2); font-size: var(--fs-md); font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav-item .i { width: 15px; height: 15px; color: var(--text-3); transition: color var(--dur) var(--ease); }
.nav-item:hover .i { color: var(--primary-text); }
.nav-item.is-active {
  background: var(--primary-50);
  color: var(--primary-text); font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--primary-100);
}
.nav-item.is-active::before {
  content: ""; position: absolute; left: -8px; top: 0; bottom: 0;
  width: 3px; background: var(--primary);
}
.nav-item.is-active .i { color: var(--primary-text); }
.nav-badge {
  margin-left: auto;
  min-width: 20px; padding: 0 6px;
  font-size: var(--fs-2xs); font-weight: 700; text-align: center;
  color: var(--text-2); background: var(--neutral-bg);
  border: 1px solid var(--border-soft); border-radius: var(--r-full);
}
.nav-item.is-active .nav-badge { color: var(--primary-text); background: #fff; border-color: var(--primary-100); }
.nav-badge.is-alert { color: #fff; background: var(--danger); border-color: var(--danger); }
.sidebar-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 13px; border-top: 1px solid var(--border-soft);
  font-size: var(--fs-2xs); color: var(--text-3);
}
.env-dot { display: inline-flex; align-items: center; gap: 5px; }
.env-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); }

/* collapsed */
body.is-sidebar-collapsed .sidebar { width: var(--sidebar-w-mini); }
body.is-sidebar-collapsed .nav-group-label,
body.is-sidebar-collapsed .nav-item span.nav-text,
body.is-sidebar-collapsed .nav-badge,
body.is-sidebar-collapsed .sidebar-foot { display: none; }
body.is-sidebar-collapsed .nav-item { justify-content: center; padding: 8px 0; }

/* --- main --- */
.main {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  padding-top: calc(var(--header-h) + var(--subbar-h));
  transition: margin-left var(--dur) var(--ease);
}
body.is-sidebar-collapsed .main { margin-left: var(--sidebar-w-mini); }
.page { padding: 16px 18px 84px; max-width: 1560px; }
.page-narrow { max-width: 1080px; }

.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.page-head .lead { margin-top: 2px; color: var(--text-2); font-size: var(--fs-md); max-width: 76ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex: none; }

/* ---------- 4. Buttons ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  font-size: var(--fs-md); font-weight: 650; letter-spacing: 0.01em;
  border-radius: var(--r-md); border: 1px solid transparent;
  transition: background var(--dur) var(--ease), border-color var(--dur), box-shadow var(--dur), color var(--dur);
  white-space: nowrap; user-select: none;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled, .btn.is-disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: linear-gradient(180deg, #ff9d1c, var(--primary)); color: #fff; border-color: #d97d00; box-shadow: inset 0 1px 0 rgba(255,255,255,.25), var(--sh-xs); text-shadow: 0 1px 1px rgba(150,80,0,.25); }
.btn-primary:hover { background: linear-gradient(180deg, #f7940f, var(--primary-hover)); color: #fff; text-decoration: none; }
.btn-primary:active { background: var(--primary-active); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--sh-xs); }
.btn-secondary:hover { background: var(--surface-subtle); border-color: #aeb9c8; color: var(--text); text-decoration: none; }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }

.btn-danger { background: var(--danger); color: #fff; box-shadow: var(--sh-xs); }
.btn-danger:hover { background: #a82c18; color: #fff; text-decoration: none; }
.btn-danger-sec { background: var(--surface); color: var(--danger); border-color: var(--danger-border); }
.btn-danger-sec:hover { background: var(--danger-bg); border-color: #e9a795; text-decoration: none; }

.btn-sm { height: 28px; padding: 0 10px; font-size: var(--fs-sm); border-radius: var(--r-sm); gap: 5px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: var(--fs-xs); border-radius: var(--r-sm); gap: 4px; }
.btn-lg { height: 40px; padding: 0 20px; font-size: var(--fs-lg); border-radius: var(--r-md); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--r-sm);
  color: var(--text-3);
  transition: background var(--dur), color var(--dur);
}
.icon-btn:hover { background: var(--surface-sunken); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.icon-btn.btn-xs { width: 24px; height: 24px; }

/* ---------- 5. Forms ------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: var(--fs-sm); font-weight: 650; color: var(--text); display: flex; align-items: center; gap: 5px; }
.req { font-size: 9px; font-weight: 700; color: #fff; background: var(--danger); border-radius: var(--r-xs); padding: 1px 4px; }
.opt { font-size: 9px; font-weight: 600; color: var(--text-3); background: var(--neutral-bg); border-radius: var(--r-xs); padding: 1px 4px; }
.field-hint { font-size: var(--fs-xs); color: var(--text-3); }
.field-error { display: flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--danger); }

.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 10px;
  font-size: var(--fs-md);
  background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
.textarea { height: auto; min-height: 68px; padding: 7px 10px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: #9aa5b3; }
.input:hover, .select:hover, .textarea:hover { border-color: #a7b4c4; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-sunken); color: var(--text-3); cursor: not-allowed; }
.input.is-error, .select.is-error, .textarea.is-error { border-color: var(--danger); }
.input.is-error:focus { box-shadow: 0 0 0 3px rgba(192, 52, 29, 0.16); }
.input-sm { height: 29px; font-size: var(--fs-sm); border-radius: var(--r-xs); }

.select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7787' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 10px; top: 50%; translate: 0 -50%; color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 33px; }
.input-icon .kbd { position: absolute; right: 8px; top: 50%; translate: 0 -50%; }
.input-affix { display: flex; align-items: stretch; }
.input-affix .input { border-radius: var(--r-sm) 0 0 var(--r-sm); border-right: 0; }
.input-affix .suffix {
  display: inline-flex; align-items: center; padding: 0 10px;
  color: var(--text-3); font-size: var(--fs-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--border-strong); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

/* checkbox / radio / switch */
.check { display: inline-flex; align-items: flex-start; gap: 7px; cursor: pointer; font-size: var(--fs-md); }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box {
  width: 16px; height: 16px; flex: none; margin-top: 2px;
  border: 1.5px solid var(--border-strong); border-radius: 3px;
  background: var(--surface); display: grid; place-items: center;
  transition: background var(--dur), border-color var(--dur), box-shadow var(--dur);
}
.check .box .i { width: 10px; height: 10px; color: #fff; stroke-width: 3; opacity: 0; }
.check input:checked + .box { background: var(--primary); border-color: var(--primary); }
.check input:checked + .box .i { opacity: 1; }
.check input:indeterminate + .box { background: var(--primary); border-color: var(--primary); }
.check input:indeterminate + .box::after { content: ""; width: 8px; height: 2px; background: #fff; border-radius: 1px; }
.check input:focus-visible + .box { box-shadow: 0 0 0 3px var(--primary-ring); }
.check input:disabled + .box { background: var(--surface-sunken); border-color: var(--border); }
.check .txt small { display: block; color: var(--text-3); font-size: var(--fs-xs); }

.check.is-radio .box { border-radius: 50%; }
.check.is-radio input:checked + .box { background: var(--surface); border-color: var(--primary); }
.check.is-radio input:checked + .box::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.check.is-radio .box .i { display: none; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--fs-md); }
.switch input { position: absolute; opacity: 0; }
.switch .track {
  width: 34px; height: 20px; flex: none;
  background: #c6d0dc; border-radius: var(--r-full);
  transition: background var(--dur);
  position: relative;
}
.switch .track::after {
  content: ""; position: absolute; top: 2.5px; left: 3px;
  width: 15px; height: 15px; border-radius: 50%; background: #fff;
  box-shadow: var(--sh-xs); transition: translate var(--dur) var(--ease);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { translate: 13px 0; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--primary-ring); }

/* segmented */
.segmented { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r-md); }
.segmented button {
  height: 27px; padding: 0 12px; font-size: var(--fs-sm); font-weight: 600;
  color: var(--text-2); border-radius: var(--r-sm);
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--surface); color: var(--primary-text); box-shadow: var(--sh-xs); font-weight: 700; }

/* ---------- 6. Badges / pills / flags -------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 8px;
  font-size: var(--fs-xs); font-weight: 650;
  border-radius: var(--r-xs); border: 1px solid transparent;
  white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill-info { color: #fff; background: #4a90d9; border-color: #3a7cc2; }
.pill-success { color: #fff; background: #2ea36b; border-color: #268a5a; }
.pill-warning { color: #fff; background: #e8940f; border-color: #c97e09; }
.pill-danger { color: #fff; background: #d1502f; border-color: #b23f22; }
.pill-teal { color: #fff; background: #1893a8; border-color: #117a8c; }
.pill-neutral { color: var(--text-2); background: var(--neutral-bg); border-color: var(--border-strong); }
.pill-primary { color: var(--primary-text); background: var(--primary-50); border-color: var(--primary-200); }
/* 淡色版（ソフト） */
.pill-soft.pill-info { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }
.pill-soft.pill-success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.pill-soft.pill-warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.pill-soft.pill-danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.pill-soft.pill-teal { color: var(--teal); background: var(--teal-bg); border-color: var(--teal-border); }

/* 業務フラグ */
.flag {
  display: inline-flex; align-items: center; gap: 3px;
  height: 19px; padding: 0 6px;
  font-size: var(--fs-2xs); font-weight: 700;
  border-radius: var(--r-xs); border: 1px solid transparent;
  white-space: nowrap;
}
.flag .i { width: 11px; height: 11px; stroke-width: 2.2; }
.flag-danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.flag-warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.flag-neutral { color: var(--text-2); background: var(--neutral-bg); border-color: var(--border); }
.flag-outline { color: var(--text-2); background: var(--surface); border-color: var(--border-strong); }

/* チャネル */
.channel { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); font-weight: 650; color: var(--text-2); }
.channel .i { width: 13px; height: 13px; }
.channel.web { color: var(--teal); }
.channel.tel { color: var(--primary-text); }

/* code chip */
.code {
  display: inline-flex; align-items: center;
  padding: 0 5px;
  font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text-2); background: var(--surface-sunken);
  border: 1px solid var(--border); border-radius: var(--r-xs);
}

/* filter chip */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 5px 0 9px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--primary-text);
  background: var(--primary-50); border: 1px solid var(--primary-100);
  border-radius: var(--r-full);
}
.chip .chip-x { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; color: var(--primary-text); }
.chip .chip-x:hover { background: var(--primary-100); }
.chip .chip-x .i { width: 9px; height: 9px; stroke-width: 2.4; }

/* ---------- 7. Alerts ------------------------------------------------------- */
.alert {
  display: flex; gap: 10px;
  padding: 10px 13px;
  border: 1px solid; border-radius: var(--r-md);
  font-size: var(--fs-md);
}
.alert .i { width: 16px; height: 16px; margin-top: 1px; flex: none; }
.alert .alert-body { min-width: 0; flex: 1; }
.alert .alert-title { font-weight: 700; }
.alert .alert-text { color: inherit; opacity: 0.92; font-size: var(--fs-sm); margin-top: 1px; }
.alert .alert-side { flex: none; display: flex; align-items: flex-start; gap: 8px; }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: #123f78; }
.alert-success { background: var(--success-bg); border-color: var(--success-border); color: #0d4f30; }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: #6f4202; }
.alert-danger { background: var(--danger-bg); border-color: var(--danger-border); color: #7e2110; }
.alert-neutral { background: var(--neutral-bg); border-color: var(--border); color: var(--text-2); }

/* ---------- 8. Cards / panels（NE 風: 見出しバーつきパネル） ------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
}
.card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 13px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #fbfcfe, #f3f6f9);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.card-head .i { color: var(--primary-text); }
.card-head h2, .card-head h3 { font-size: var(--fs-lg); font-weight: 750; letter-spacing: 0.01em; }
.card-head .sub { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; }
.card-head .head-side { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); }
.card-head .head-side a, .card-foot a { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.card-body { padding: 13px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 8px 13px; border-top: 1px solid var(--border-soft); font-size: var(--fs-xs); color: var(--text-3); }

.section-tag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex: none;
  font-size: var(--fs-xs); font-weight: 800; color: #fff;
  background: linear-gradient(180deg, #ffa21f, var(--primary));
  border-radius: var(--r-xs);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28);
}

/* description list */
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: var(--fs-md); }
.dl dt { color: var(--text-3); font-size: var(--fs-sm); white-space: nowrap; }
.dl dd { min-width: 0; }
.dl-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 20px; }
.dl-cols > div { display: grid; grid-template-columns: 82px 1fr; gap: 8px; align-items: baseline; }
.dl-cols dt { color: var(--text-3); font-size: var(--fs-sm); }
.dl-cols dd { min-width: 0; }

/* ---------- 9. Tables（NE 風: 高密度グリッド＋操作ツールバー） ------------------ */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-xs); overflow: clip; }
.table-scroll { overflow-x: auto; }
.tbl { font-size: var(--fs-md); min-width: 100%; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  padding: 7px 10px;
  font-size: var(--fs-xs); font-weight: 700;
  color: var(--text-2); text-align: left; white-space: nowrap;
  background: linear-gradient(180deg, #f7f9fb, #eef2f6);
  border-bottom: 1px solid var(--border-strong);
  border-right: 1px solid var(--border-soft);
}
.tbl th:last-child { border-right: 0; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tbody tr { transition: background var(--dur); }
.tbl tbody tr:hover { background: var(--surface-hover); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.is-selected { background: var(--primary-50); }
.tbl tbody tr.is-selected:hover { background: #fbeed6; }
.tbl tbody tr.is-alert-row { background: #fff8f6; }
.tbl tbody tr.is-alert-row:hover { background: #fdeee9; }
.tbl .t-num { text-align: right; white-space: nowrap; }
.tbl .t-actions { text-align: right; white-space: nowrap; width: 1%; }
/* 2行セルは最小幅を確保し、不足時はテーブルごと横スクロール（縮めすぎて縦書き化しない） */
.tbl .cell-2line { display: flex; flex-direction: column; gap: 0; min-width: 7em; }
.tbl .cell-2line .l1 { font-weight: 650; color: var(--text); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; overflow-wrap: anywhere; }
.tbl .cell-2line .l2 { font-size: var(--fs-xs); color: var(--text-3); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; overflow-wrap: anywhere; }
.tbl .row-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity var(--dur); }
.tbl tr:hover .row-actions, .tbl tr:focus-within .row-actions { opacity: 1; }
.tbl .sort { display: inline-flex; align-items: center; gap: 3px; font: inherit; color: inherit; }
.tbl .sort:hover { color: var(--text); }
.tbl .sort .i { width: 12px; height: 12px; color: var(--text-3); }
.tbl .sort.is-sorted { color: var(--primary-text); }
.tbl .sort.is-sorted .i { color: var(--primary-text); }

/* comfortable（密度を緩めたい場合） */
.is-comfortable .tbl th { padding: 10px 12px; }
.is-comfortable .tbl td { padding: 11px 12px; }

/* 列の表示切替 */
.tbl.col-hide-channel [data-col="channel"],
.tbl.col-hide-shop [data-col="shop"],
.tbl.col-hide-note [data-col="note"] { display: none; }

/* 操作ツールバー（一覧の上の一括処理行） */
.action-bar {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 8px 10px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
}
.action-bar .sel-info { font-size: var(--fs-sm); color: var(--text-3); margin-right: 4px; }
.action-bar .sel-info b { color: var(--primary-text); font-variant-numeric: tabular-nums; }
.action-bar .bar-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 3px; }
.action-bar .spacer { flex: 1; }

/* thumb */
.thumb {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  color: var(--text-3); background: var(--surface-sunken);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}

/* stock meter */
.meter { width: 58px; height: 5px; background: var(--surface-sunken); border-radius: 3px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--success); }
.meter.low > i { background: var(--warning); }
.meter.out > i { background: var(--danger); }

/* 進捗メーター（一括変更）。幅をインラインstyleで書けないので progress 要素で持つ */
.meter--wide { display: block; width: 240px; height: 8px; border: 0; }
progress.meter { appearance: none; -webkit-appearance: none; }
progress.meter::-webkit-progress-bar { background: var(--surface-sunken); border-radius: 3px; }
progress.meter::-webkit-progress-value { background: var(--success); border-radius: 3px; }
progress.meter::-moz-progress-bar { background: var(--success); border-radius: 3px; }

/* ---------- 10. Tabs / pagination / breadcrumb ------------------------------- */
.tabs { display: flex; align-items: center; gap: 2px; border-bottom: 2px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px 9px; font-size: var(--fs-md); font-weight: 600; color: var(--text-2);
  white-space: nowrap;
  transition: color var(--dur), background var(--dur);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.tab:hover { color: var(--primary-text); background: var(--primary-50); text-decoration: none; }
.tab.is-active { color: var(--primary-text); font-weight: 750; background: var(--surface); }
.tab.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2.5px; background: var(--primary);
}
.tab .count {
  min-width: 19px; padding: 0 5px; text-align: center;
  font-size: var(--fs-2xs); font-weight: 700;
  color: var(--text-2); background: var(--surface-sunken);
  border-radius: var(--r-full);
}
.tab.is-active .count { color: #fff; background: var(--primary); }
.tab .count.is-alert { color: #fff; background: var(--danger); }

.pager { display: flex; align-items: center; gap: 4px; }
.pager .page-btn {
  min-width: 28px; height: 28px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-md); font-weight: 600; color: var(--text-2);
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.pager .page-btn:hover { background: var(--surface-subtle); border-color: var(--border-strong); }
.pager .page-btn.is-current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager .page-btn:disabled { opacity: 0.45; cursor: default; background: var(--surface); }
.pager .ellipsis { color: var(--text-3); padding: 0 2px; }

/* ---------- 11. Dropdown / modal / drawer / palette / toast -------------------- */
.menu-anchor { position: relative; }
.dropdown {
  position: absolute; top: calc(100% + 5px); right: 0; z-index: var(--z-dropdown);
  min-width: 210px; padding: 5px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-lg);
}
.dropdown.left { left: 0; right: auto; }
.dropdown .menu-label { padding: 6px 9px 4px; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.06em; color: var(--text-3); }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; font-size: var(--fs-md); font-weight: 500; color: var(--text);
  border-radius: var(--r-sm); text-align: left;
  transition: background var(--dur);
}
.menu-item:hover { background: var(--surface-hover); text-decoration: none; }
.menu-item .i { color: var(--text-3); }
.menu-item .kbd, .menu-item .right { margin-left: auto; }
.menu-item .right { font-size: var(--fs-xs); color: var(--text-3); }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger .i { color: var(--danger); }
.menu-item.is-active { background: var(--primary-50); color: var(--primary-text); font-weight: 650; }
.menu-item.is-active .i { color: var(--primary-text); }
.menu-sep { height: 1px; margin: 4px; background: var(--border-soft); }

/* notification */
.notif-item { display: flex; gap: 9px; padding: 8px 9px; border-radius: var(--r-sm); }
.notif-item:hover { background: var(--surface-hover); }
.notif-icon { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: var(--r-sm); }
.notif-icon.warn { color: var(--warning); background: var(--warning-bg); }
.notif-icon.err { color: var(--danger); background: var(--danger-bg); }
.notif-icon.ok { color: var(--success); background: var(--success-bg); }
.notif-icon.info { color: var(--info); background: var(--info-bg); }
.notif-item .nt { font-size: var(--fs-sm); font-weight: 650; }
.notif-item .nd { font-size: var(--fs-xs); color: var(--text-3); margin-top: 1px; }
.notif-item .ntime { margin-left: auto; font-size: var(--fs-2xs); color: var(--text-3); white-space: nowrap; }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: grid; place-items: center; padding: 24px;
  background: rgba(20, 28, 40, 0.5);
}
.modal {
  width: 500px; max-width: 100%; max-height: calc(100vh - 60px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  overflow: hidden;
}
.modal-head { display: flex; align-items: center; gap: 9px; padding: 13px 17px 10px; }
.modal-head h3 { font-size: var(--fs-lg); font-weight: 750; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 0 17px 13px; overflow-y: auto; font-size: var(--fs-md); color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 17px; background: var(--surface-subtle); border-top: 1px solid var(--border-soft); }
.modal-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; }
.modal-icon.danger { color: var(--danger); background: var(--danger-bg); }
.modal-icon.warn { color: var(--warning); background: var(--warning-bg); }

/* drawer */
.drawer-backdrop { position: fixed; inset: 0; z-index: var(--z-overlay); background: rgba(20, 28, 40, 0.45); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: calc(var(--z-overlay) + 1);
  width: 470px; max-width: 94vw;
  display: flex; flex-direction: column;
  background: var(--surface); box-shadow: var(--sh-xl);
  border-left: 1px solid var(--border);
}
.drawer-head { display: flex; align-items: center; gap: 9px; padding: 12px 15px; border-bottom: 1px solid var(--border-soft); background: linear-gradient(180deg, #fbfcfe, #f3f6f9); }
.drawer-head h3 { font-size: var(--fs-lg); font-weight: 750; }
.drawer-body { flex: 1; overflow-y: auto; padding: 13px 15px; }
.drawer-foot { padding: 10px 15px; border-top: 1px solid var(--border-soft); display: flex; gap: 8px; background: var(--surface-subtle); }

/* command palette */
.palette-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(20, 28, 40, 0.5); display: flex; justify-content: center; padding: 11vh 20px 20px; }
.palette {
  width: 600px; max-width: 100%; height: fit-content; max-height: 62vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-xl); overflow: hidden;
  border: 1px solid var(--border);
}
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-bottom: 1px solid var(--border-soft); }
.palette-input .i { color: var(--text-3); }
.palette-input input { flex: 1; border: 0; outline: none; font-size: var(--fs-lg); background: transparent; }
.palette-list { overflow-y: auto; padding: 7px; }
.palette-group { padding: 7px 9px 3px; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.06em; color: var(--text-3); }
.palette-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 9px; border-radius: var(--r-sm); text-align: left;
  font-size: var(--fs-md); font-weight: 550;
}
.palette-item .i { color: var(--text-3); }
.palette-item small { color: var(--text-3); font-size: var(--fs-xs); }
.palette-item .kbd { margin-left: auto; }
.palette-item.is-active, .palette-item:hover { background: var(--primary-50); color: var(--primary-text); }
.palette-item.is-active .i, .palette-item:hover .i { color: var(--primary-text); }
.palette-foot { display: flex; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--border-soft); font-size: var(--fs-xs); color: var(--text-3); background: var(--surface-subtle); }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; translate: -50% 0; z-index: var(--z-toast);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 15px;
  color: #fff; font-size: var(--fs-md); font-weight: 600;
  background: #232a38; border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
}
.toast .i { color: #ffb85c; }

/* tooltip */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; translate: -50% 0;
  z-index: var(--z-toast);
  padding: 4px 8px; white-space: nowrap;
  font-size: var(--fs-xs); font-weight: 600; color: #fff;
  background: #232a38; border-radius: var(--r-sm);
  box-shadow: var(--sh-md); pointer-events: none;
}

/* ---------- 12. KPI tiles / timeline / stepper / misc ------------------------ */
/* NE 風の件数タイル */
.tiles { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.tile {
  display: flex; flex-direction: column; gap: 1px;
  padding: 9px 11px 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
  transition: border-color var(--dur), box-shadow var(--dur), translate var(--dur);
}
.tile:hover { border-color: var(--primary-200); box-shadow: var(--sh-sm); text-decoration: none; translate: 0 -1px; }
.tile .t-label { font-size: var(--fs-xs); font-weight: 650; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.tile .t-label .i { width: 12px; height: 12px; }
.tile .t-value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: -0.01em; }
.tile .t-sub { font-size: var(--fs-2xs); color: var(--text-3); }
.tile.warn .t-label { color: var(--warning); }
.tile.warn .t-value { color: var(--warning); }
.tile.err .t-label { color: var(--danger); }
.tile.err .t-value { color: var(--danger); }
.tile.ok .t-value { color: var(--success); }

/* timeline */
.timeline { position: relative; padding-left: 4px; }
.tl-item { position: relative; display: flex; gap: 11px; padding-bottom: 13px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: 9px; top: 22px; bottom: -2px; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-dot {
  width: 20px; height: 20px; flex: none; z-index: 1;
  display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--border-strong); border-radius: 50%;
  color: var(--text-3);
}
.tl-dot .i { width: 10px; height: 10px; }
.tl-item.is-now .tl-dot { border-color: var(--primary); color: var(--primary-text); background: var(--primary-50); }
.tl-item.is-done .tl-dot { border-color: var(--success); color: #fff; background: var(--success); }
.tl-body { min-width: 0; flex: 1; }
.tl-time { font-size: var(--fs-2xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl-text { font-size: var(--fs-md); font-weight: 600; margin-top: 1px; }
.tl-actor { font-size: var(--fs-xs); color: var(--text-3); }

/* stepper */
.stepper { display: flex; align-items: center; gap: 5px; }
.step { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 6px; border-radius: var(--r-full); font-size: var(--fs-md); font-weight: 650; color: var(--text-3); transition: background var(--dur); }
.step:hover { background: var(--surface-hover); text-decoration: none; }
.step .s-dot {
  width: 22px; height: 22px; display: grid; place-items: center;
  font-size: var(--fs-xs); font-weight: 800;
  background: var(--surface-sunken); border: 1.5px solid var(--border-strong);
  color: var(--text-3); border-radius: 50%;
}
.step .s-dot .i { width: 11px; height: 11px; stroke-width: 2.6; }
.step.is-done { color: var(--success); }
.step.is-done .s-dot { background: var(--success); border-color: var(--success); color: #fff; }
.step.is-current { color: var(--primary-text); background: var(--primary-50); }
.step.is-current .s-dot { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 3px var(--primary-ring); }
.step-sep { width: 16px; height: 1.5px; background: var(--border-strong); flex: none; }

/* KPI card */
.kpi {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
}
.kpi-top { display: flex; align-items: center; gap: 8px; }
.kpi-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: var(--r-sm); flex: none; }
.kpi-icon.orange { color: var(--primary-text); background: var(--primary-50); }
.kpi-icon.blue { color: var(--info); background: var(--info-bg); }
.kpi-icon.green { color: var(--success); background: var(--success-bg); }
.kpi-icon.red { color: var(--danger); background: var(--danger-bg); }
.kpi-icon.teal { color: var(--teal); background: var(--teal-bg); }
.kpi-label { font-size: var(--fs-sm); font-weight: 650; color: var(--text-2); }
.kpi-value { display: flex; align-items: baseline; gap: 6px; margin-top: 1px; }
.kpi-value .v { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-value .u { font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); }
.kpi-sub { font-size: var(--fs-xs); color: var(--text-3); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.kpi-spark { position: absolute; right: 12px; bottom: 10px; opacity: 0.9; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-xs); font-weight: 750; padding: 1px 5px; border-radius: var(--r-full); }
.delta .i { width: 11px; height: 11px; }
.delta.up { color: var(--success); background: var(--success-bg); }
.delta.down { color: var(--danger); background: var(--danger-bg); }
.delta.flat { color: var(--text-2); background: var(--neutral-bg); }

/* list rows */
.row-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 13px; font-size: var(--fs-md); font-weight: 600; color: var(--text);
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--dur);
}
.row-link:last-child { border-bottom: 0; }
.row-link:hover { background: var(--surface-hover); text-decoration: none; }
.row-link .cnt { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 5px; }
.row-link .sub { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; }

/* quick view items */
.qv-items { border: 1px solid var(--border-soft); border-radius: var(--r-md); overflow: hidden; }
.qv-item { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-bottom: 1px solid var(--border-soft); font-size: var(--fs-sm); }
.qv-item:last-child { border-bottom: 0; }
.qv-item .q { margin-left: auto; white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* summary */
.sum-rows { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-md); }
.sum-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sum-row dt { color: var(--text-2); }
.sum-row dd { font-variant-numeric: tabular-nums; font-weight: 600; }
.sum-total { margin-top: 5px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; align-items: baseline; justify-content: space-between; }
.sum-total .t { font-size: var(--fs-lg); font-weight: 750; }
.sum-total .v { font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--primary-text); }
.sum-tax { text-align: right; font-size: var(--fs-xs); color: var(--text-3); margin-top: 1px; }

/* sticky rail */
.rail { position: sticky; top: calc(var(--header-h) + var(--subbar-h) + 14px); display: flex; flex-direction: column; gap: 12px; }

/* skeleton */
.skel { position: relative; overflow: hidden; background: var(--surface-sunken); border-radius: var(--r-sm); }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
  animation: skel 1.4s infinite;
  translate: -100% 0;
}
@keyframes skel { to { translate: 100% 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .skel::after { animation: none; }
}

/* empty */
.empty { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 40px 20px; text-align: center; }
.empty .e-icon { width: 44px; height: 44px; display: grid; place-items: center; color: var(--text-3); background: var(--surface-sunken); border-radius: 50%; margin-bottom: 3px; }
.empty .e-title { font-weight: 700; font-size: var(--fs-lg); }
.empty .e-text { font-size: var(--fs-sm); color: var(--text-3); max-width: 40ch; }

/* ---------- 13. Page layouts ------------------------------------------------ */
.layout-2col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.layout-main-rail { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
/* 中の横スクロール要素（表・チャート）がページ幅を押し広げないようにする */
.layout-2col > *, .layout-main-rail > *, .stack > *, .rail > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 13px; }
.form-grid .span2 { grid-column: span 2; }

/* 検索パネル（NE 風: 常時展開の検索条件。モバイルは既定で折りたたみ） */
.search-panel .sp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px 12px; }
.search-panel .sp-grid .span2 { grid-column: span 2; }
.search-panel .sp-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
/* 適用中の条件は専用行（全幅）に表示し、ボタン行の横に押し込めない */
.search-panel .sp-applied { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.search-panel .sp-applied .lbl { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }
/* モバイル用の開閉（PC では常時展開のまま・ボタン非表示） */
.sp-toggle { display: none; }
.sp-summary { display: none; font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; white-space: nowrap; }
@media (max-width: 760px) {
  .sp-toggle { display: inline-flex; }
  .search-panel .card-body { display: none; }
  .search-panel.is-open .card-body { display: block; }
  .search-panel.is-open .sp-toggle .i { rotate: 180deg; }
  .search-panel:not(.is-open) .sp-summary { display: inline; }
  .search-panel:not(.is-open) .card-head { border-bottom: 0; border-radius: var(--r-md); }
}

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.chips-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.chips-row .lbl { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }

/* detail meta strip */
.meta-strip { display: flex; flex-wrap: wrap; gap: 5px 0; font-size: var(--fs-sm); color: var(--text-2); }
.meta-strip > span { display: inline-flex; align-items: center; gap: 5px; padding-right: 12px; margin-right: 12px; border-right: 1px solid var(--border); }
.meta-strip > span:last-child { border-right: 0; }
.meta-strip .i { color: var(--text-3); width: 13px; height: 13px; }
.meta-strip b { color: var(--text); font-weight: 650; }

/* progress steps */
.progress-steps { display: flex; align-items: flex-start; }
.p-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative; text-align: center; }
.p-step::before { content: ""; position: absolute; top: 11px; left: -50%; right: 50%; height: 2.5px; background: var(--border); z-index: 0; }
.p-step:first-child::before { display: none; }
.p-step .p-dot {
  position: relative; z-index: 1;
  width: 23px; height: 23px; display: grid; place-items: center;
  background: var(--surface); border: 2.5px solid var(--border-strong); border-radius: 50%;
  color: var(--text-3); font-size: 10px; font-weight: 800;
}
.p-step .p-dot .i { width: 11px; height: 11px; stroke-width: 2.6; }
.p-step .p-lbl { font-size: var(--fs-xs); font-weight: 650; color: var(--text-3); }
.p-step.is-done .p-dot { background: var(--success); border-color: var(--success); color: #fff; }
.p-step.is-done::before { background: var(--success); }
.p-step.is-done .p-lbl { color: var(--success); }
.p-step.is-now .p-dot { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-ring); }
.p-step.is-now::before { background: var(--success); }
.p-step.is-now .p-lbl { color: var(--primary-text); font-weight: 750; }

/* chart */
.chart { padding: 6px 12px 2px; overflow-x: auto; }
.chart-grid { display: grid; grid-template-rows: repeat(4, 1fr); position: absolute; inset: 0; }
.chart-grid i { border-top: 1px dashed var(--border); }
.chart-bars { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; min-width: 470px; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar .bar {
  width: 100%; max-width: 32px; border-radius: 3px 3px 1px 1px;
  background: #ffdca6;
  transition: background var(--dur);
  position: relative;
}
.chart-bar:hover .bar { background: #ffc878; }
.chart-bar.is-today .bar { background: linear-gradient(180deg, #ffa21f, var(--primary)); }
.chart-bar .bar-val {
  position: absolute; top: -19px; left: 50%; translate: -50% 0;
  font-size: var(--fs-2xs); font-weight: 800; color: var(--primary-text);
  opacity: 0; transition: opacity var(--dur);
}
.chart-bar:hover .bar-val, .chart-bar.is-today .bar-val { opacity: 1; }
.chart-bar .x { font-size: var(--fs-2xs); color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-bar.is-today .x { color: var(--primary-text); font-weight: 800; }

/* ---------- 14. Demo bar ------------------------------------------------------ */
.demo-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: var(--z-toast);
  display: flex; align-items: center; gap: 11px;
  height: 32px; padding: 0 13px;
  font-size: var(--fs-xs); color: #cfd8e4;
  background: #1b212c; box-shadow: 0 -1px 8px rgba(20,28,40,.2);
}
.demo-bar a { color: #ffc878; }
.demo-tag {
  font-size: 9px; font-weight: 800; letter-spacing: 0.1em;
  color: #ffd9a0; background: rgba(240, 140, 0, 0.16);
  border: 1px solid rgba(240, 140, 0, 0.4);
  padding: 1px 7px; border-radius: var(--r-full);
}
.demo-bar select {
  height: 21px; font-size: var(--fs-xs); color: #e9edf4;
  background: #2c3648; border: 1px solid #47536a; border-radius: 4px; padding: 0 4px;
}
.demo-sep { width: 1px; height: 13px; background: #3a465c; }
.demo-bar .spacer { flex: 1; }
body.has-demo-bar .page { padding-bottom: 100px; }
.is-capture .demo-bar { display: none; }

/* ---------- 15. Invoice（帳票） ------------------------------------------------ */
.sheet-wrap { background: var(--bg-deep); padding: 22px; border-radius: var(--r-md); }
.sheet {
  width: 210mm; max-width: 100%; min-height: 280mm;
  margin: 0 auto; padding: 16mm 15mm 14mm;
  background: #fff; box-shadow: var(--sh-lg);
  color: #111; font-size: 12px; line-height: 1.6;
  position: relative;
}
.sheet .doc-band {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding-bottom: 10px; margin-bottom: 16px;
  border-bottom: 3px solid #e07d00;
}
.sheet .doc-title { font-size: 26px; font-weight: 800; letter-spacing: 0.14em; color: #1c2532; }
.sheet .doc-title small { display: block; font-size: 10px; letter-spacing: 0.3em; color: #6b7787; font-weight: 700; margin-top: 2px; }
.sheet .doc-no { text-align: right; font-size: 11px; color: #4a5568; }
.sheet .doc-no b { display: block; font-size: 12.5px; color: #1c2532; }
.sheet table.plain th { background: #f4f6f9; border: 1px solid #d4dce5; padding: 6px 9px; font-size: 10.5px; text-align: left; }
.sheet table.plain td { border: 1px solid #d4dce5; padding: 6px 9px; }
.sheet .amount-box {
  border: 2px solid #1c2532; border-radius: 5px; padding: 10px 16px;
  display: flex; align-items: baseline; gap: 14px;
}
.sheet .amount-box .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.sheet .reg-no { font-size: 11px; color: #4a5568; }
.internal-copy-mark {
  position: absolute; top: 5mm; right: 8mm;
  padding: 3px 10px; font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  color: var(--danger); border: 2px solid var(--danger); border-radius: 4px;
  rotate: 4deg; opacity: 0.85;
}

@media print {
  body { background: #fff; }
  .no-print, .sidebar, .topbar, .subbar, .demo-bar, .toast { display: none !important; }
  .main { margin: 0; padding: 0; }
  .page { padding: 0; max-width: none; }
  .sheet-wrap { background: #fff; padding: 0; }
  .sheet { box-shadow: none; width: auto; min-height: auto; margin: 0; }
}

/* ---------- 16. Responsive ----------------------------------------------------- */
@media (max-width: 1240px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .search-panel .sp-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar .global-search { width: 190px; }
}
@media (max-width: 1023px) {
  .layout-2col, .layout-main-rail { grid-template-columns: 1fr; }
  .rail { position: static; }
}
@media (max-width: 760px) {
  .page-head { flex-direction: column; gap: 9px; }
  .page-head .actions { margin-left: 0; flex-wrap: wrap; }
  .stepper { overflow-x: auto; padding-bottom: 4px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .meta-strip > span { padding-right: 8px; margin-right: 8px; }
  .sidebar { translate: -100% 0; transition: translate 0.2s var(--ease); width: 260px; box-shadow: var(--sh-xl); top: 0; }
  body.is-sidebar-open .sidebar { translate: 0 0; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(20,28,40,.45); }
  .subbar { left: 0; padding: 0 12px; gap: 8px; }
  .subbar h1 { font-size: 15px; }
  .main { margin-left: 0; }
  .page { padding: 12px 10px 92px; }
  .topbar .global-search { display: none; }
  .topbar { gap: 6px; padding: 0 10px; }
  /* 店舗チップはアイコン＋スコープのみに圧縮（店舗名はユーザーメニューで確認） */
  .topbar .store-chip { padding: 0 7px; }
  .topbar .store-chip .chip-label,
  .topbar .store-chip > .i-sm { display: none; }
  .grid-2, .grid-3, .grid-4, .form-grid, .search-panel .sp-grid { grid-template-columns: 1fr; }
  .form-grid .span2, .search-panel .sp-grid .span2 { grid-column: auto; }
  .user-meta { display: none; }
  .dl-cols { grid-template-columns: 1fr; }
  .brand-name { display: none; }
  .brand { padding-right: 4px; margin-right: 0; border-right: 0; }
}
@media (min-width: 761px) { .sidebar-backdrop { display: none; } .menu-only-mobile { display: none; } }

/* =========================================================================
   16. G1 overrides & legacy compatibility  (D-222 / implementation-spec §4,§6,§7)
   - 色・寸法の上書きは「アクセシビリティのため」に限定する
   - 旧クラスは G2〜G6 の移行が終わるまで残す（画面を一度に書き換えない）
   ========================================================================= */

/* --- 16-1. token overrides ---------------------------------------------- */
:root {
  --primary-ink: #1c2532;      /* 主ボタン文字（on #f08c00 = 6.22:1） */
  --focus-color: #b45309;      /* フォーカスリング（on #fff = 5.02:1） */
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--focus-color);
  --warning: #8a5300;          /* ソリッド警告ピル（白文字 6.33:1） */
  --border-strong: #7c8a9c;    /* 入力枠（on #fff = 3.52:1） */
}

.btn-primary, .btn.primary, button.primary {
  background: var(--primary);
  border-color: var(--primary-hover);
  color: var(--primary-ink);
  text-shadow: none;
}
.btn-primary:hover, .btn.primary:hover, button.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-active);
  color: var(--primary-ink);
  text-decoration: none;
}
.btn-primary:active, .btn.primary:active, button.primary:active {
  background: var(--primary-active);
}

/* 2px の実線リング。色だけでなく形でも見えるようにする */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}
.btn:focus-visible, .icon-btn:focus-visible, .h-btn:focus-visible,
.input:focus-visible, .select:focus-visible {
  box-shadow: none;
}

/* --- 16-2. auth layout --------------------------------------------------- */
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-shell {
  width: min(1060px, 100%); display: grid; grid-template-columns: 380px minmax(0, 1fr);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--sh-lg);
}
.auth-brand {
  display: flex; flex-direction: column; gap: 16px; padding: 32px 30px;
  color: var(--header-text); background: linear-gradient(160deg, var(--header-bg), var(--header-bg-2));
}
.auth-brand .brand { display: flex; align-items: center; gap: 10px; padding: 0; margin: 0; border: 0; }
.auth-brand .brand-name b { font-size: 13px; }
.auth-brand .auth-eyebrow { margin-top: 20px; font-size: var(--fs-2xs); font-weight: 750; letter-spacing: 0.16em; color: #ffb85c; }
.auth-brand h2 { font-size: 23px; line-height: 1.5; font-weight: 800; letter-spacing: 0.01em; }
.auth-brand p { color: var(--header-muted); font-size: var(--fs-sm); line-height: 1.75; }
.auth-brand .auth-points { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.auth-brand .auth-point { display: flex; gap: 9px; align-items: flex-start; font-size: var(--fs-xs); line-height: 1.6; color: var(--header-muted); }
.auth-brand .auth-point .i { color: #ffb85c; margin-top: 2px; }
.auth-brand .auth-foot { margin-top: auto; font-size: var(--fs-2xs); color: var(--header-muted); }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 44px 48px; }
.auth-panel .auth-form { width: min(420px, 100%); margin: 0 auto; }
.auth-panel .auth-eyebrow { font-size: var(--fs-2xs); font-weight: 750; letter-spacing: 0.14em; color: var(--primary-text); }
.auth-panel h1 { font-size: 26px; font-weight: 800; margin: 6px 0 4px; }
.auth-panel .lead { color: var(--text-2); font-size: var(--fs-md); margin-bottom: 18px; }
.auth-panel .input, .auth-panel select { height: 40px; }
.auth-panel .btn { width: 100%; height: 42px; margin-top: 4px; }
.auth-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border-soft); font-size: var(--fs-xs); line-height: 1.75; color: var(--text-3); }
.auth-note .i { color: var(--success); }
@media (max-width: 900px) {
  .auth-main { padding: 12px; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-panel { padding: 28px 20px; }
}

/* --- 16-3. shell additions ----------------------------------------------- */
.topbar form.global-search { padding: 0 8px 0 10px; }
.topbar .global-search input[type="search"] {
  flex: 1; min-width: 0; width: auto; height: 24px; padding: 0;
  border: 0; background: transparent; color: var(--header-text); outline: none;
}
.topbar .global-search input[type="search"]::placeholder { color: var(--header-muted); opacity: 1; }
.topbar .global-search:focus-within {
  background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.28);
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.topbar .global-search .kbd { margin-left: 0; }

.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu[open] > summary { background: var(--header-hover); }
.user-menu:not([open]) .dropdown { display: none; }
.user-menu .dropdown { min-width: 240px; }
.user-menu form { margin: 0; }

.sidebar-toggle .when-collapsed { display: none; }
body.is-sidebar-collapsed .sidebar-toggle .when-collapsed { display: block; }
body.is-sidebar-collapsed .sidebar-toggle .when-expanded { display: none; }
.sidebar-foot .env-dot::before { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }

/* 一覧が主役。ページ全体を広く使う */
.main { min-height: 100vh; }
.page { padding: 16px 18px 72px; max-width: none; }
.page > h1 { font-size: 17px; font-weight: 750; margin: 0 0 12px; }
.page h2 { font-size: var(--fs-lg); font-weight: 750; margin: 22px 0 8px; }
.page h3 { font-size: var(--fs-md); font-weight: 700; margin: 16px 0 6px; }
.page p { margin: 0 0 9px; }
.page ul, .page ol { margin: 0 0 10px; padding-left: 1.5em; }
.page ul { list-style: disc; }
.page ol { list-style: decimal; }
.page li { margin: 2px 0; }
.page dl { margin: 0 0 10px; }
.page dt { font-weight: 700; margin-top: 8px; }
.page dd { margin: 0 0 4px; }
.page hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.page code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; background: var(--surface-sunken); padding: 1px 4px; border-radius: var(--r-xs); }

/* --- 16-4. legacy elements ----------------------------------------------- */
.page label, .auth-panel label { display: block; margin: 10px 0; font-size: var(--fs-sm); font-weight: 650; }
.page label input[type="checkbox"], .page label input[type="radio"] { width: auto; height: auto; margin-right: 4px; }
.page input[type="text"], .page input[type="email"], .page input[type="password"],
.page select, .page textarea,
.auth-panel input[type="text"], .auth-panel input[type="email"], .auth-panel input[type="password"] {
  width: 100%; height: 34px; padding: 0 9px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
}
.page input[type="number"], .page input[type="date"] {
  height: 34px; padding: 0 9px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
}
.page textarea, .auth-panel textarea { height: auto; min-height: 5.5em; padding: 7px 9px; line-height: 1.55; }
.page input:focus, .page select:focus, .page textarea:focus,
.auth-panel input:focus, .auth-panel select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); outline: none;
}
.page input[type="checkbox"], .page input[type="radio"] { accent-color: var(--primary); }

/* 素の button（旧画面）。v3 の .btn は別に定義済み */
.page button:not(.btn):not(.icon-btn):not(.h-btn):not(.menu-item):not(.tab):not(.draft-chip),
.auth-panel button:not(.btn) {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 34px; padding: 0 12px;
  font-size: var(--fs-md); font-weight: 650; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  cursor: pointer;
}
.page button:not(.btn):not(.icon-btn):not(.h-btn):not(.menu-item):not(.tab):not(.draft-chip):hover,
.auth-panel button:not(.btn):hover { background: var(--surface-subtle); }
.page button.danger, .auth-panel button.danger, .btn.danger {
  color: var(--danger); border-color: var(--danger-border); background: var(--danger-bg);
}
.page button.small, .btn.small { min-height: 26px; height: 26px; padding: 0 8px; font-size: var(--fs-xs); }

/* 旧 .btn は「二次ボタン」として見せる */
.page .btn:not(.btn-primary):not(.btn-secondary):not(.btn-danger):not(.btn-ghost):not(.btn-sm):not(.btn-xs) {
  background: var(--surface); border-color: var(--border-strong); color: var(--text);
}
.page .btn:hover { text-decoration: none; }

/* 表（旧 <table>）。v3 の .tbl と同じ密度に寄せる */
.page table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); font-size: var(--fs-md);
}
.page th, .page td { padding: 7px 10px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: top; }
.page th {
  font-size: var(--fs-xs); font-weight: 700; color: var(--text-2); white-space: nowrap;
  background: linear-gradient(180deg, #f7f9fb, #eef2f6);
  border-bottom: 1px solid var(--border-strong);
}
.page tbody tr:hover { background: var(--surface-hover); }
.page tbody tr:last-child td { border-bottom: 0; }
.page tr.selected td { background: var(--primary-50); font-weight: 600; }
.page td.num, .page .num { text-align: right; }
.page th.num { text-align: right; }
.page .kv th { width: 10rem; }
.page td.warn, .page .warn { color: var(--warning); }
.page .neg { color: var(--danger); }

/* 見出し・説明の旧クラス */
.page .small { font-size: var(--fs-sm); }
.page .muted { color: var(--text-3); }
.page .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
.page .inline { display: inline; }
.page .center { text-align: center; }
.page .actions { margin: 14px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page .grow { flex: 1; min-width: 0; }
.page .wide { max-width: none; }

/* カード（旧） */
.page .card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 13px 15px; max-width: 460px;
}
.page .card.wide { max-width: none; }
.page .card > h2:first-child, .page .card > h3:first-child { margin-top: 0; }
.page .card h2 { font-size: var(--fs-lg); margin: 0 0 10px; }
.page .card h3 { font-size: var(--fs-md); margin: 0 0 8px; }
.page .card p:last-child { margin-bottom: 0; }

/* 検索フォーム（旧） */
.page .filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.page .filters input[type="text"] { width: 22rem; max-width: 100%; }
.page .filters select, .page .filters button { width: auto; }
.page .filters label { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-weight: 600; }

/* ページャ */
.page .pager { display: flex; gap: 12px; align-items: center; margin: 14px 0; font-size: var(--fs-sm); }
.page .pager a { color: var(--link); }

/* タブ（旧 .tabs a.on） */
.page .tabs { display: flex; gap: 2px; margin: 12px 0; border-bottom: 2px solid var(--border); overflow-x: auto; }
.page .tabs a {
  padding: 8px 12px 9px; margin-bottom: -2px;
  font-size: var(--fs-md); font-weight: 600; color: var(--text-2);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.page .tabs a:hover { color: var(--text); text-decoration: none; background: var(--surface-hover); }
.page .tabs a.on { color: var(--primary-text); border-bottom-color: var(--primary); }

/* バッジ・タグ */
.page .badge {
  display: inline-block; padding: 0 6px; border-radius: var(--r-xs);
  font-size: var(--fs-2xs); font-weight: 650; line-height: 1.7; white-space: nowrap;
  color: var(--text-2); background: var(--neutral-bg); border: 1px solid var(--neutral-border);
}
.page .badge.bl { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.page .badge.warn { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.page .badge.on { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.page .tag { display: inline-block; padding: 0 6px; border-radius: var(--r-xs); background: var(--neutral-bg); font-size: var(--fs-2xs); }
.page .tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.page .tags li { display: flex; align-items: center; gap: 4px; margin: 0; }

/* メッセージ */
.page .msg { padding: 9px 12px; border-radius: var(--r-sm); background: var(--success-bg); border: 1px solid var(--success-border); color: var(--text); }
.page .error { padding: 9px 12px; border-radius: var(--r-sm); background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--text); }

/* グリッド・行 */
.page .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.page .grid2 > .card { min-width: 0; max-width: none; }
.page .row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.page .row label { margin: 0; }

/* 入力幅の旧指定 */
.page .w-code { width: 10rem; }
/* 値名など、表の中で幅いっぱいに使う入力（S-06 オプション値） */
.page .w-code.w-full { width: 100%; }
.page .w-price { width: 7rem; }
.page .w-8em { width: 8em; }
.page .textarea-full { width: 100%; min-height: 6em; }
.page .border-danger { border-color: var(--danger); }

/* 整形ユーティリティ（CSP: インラインstyleの代替） */
.page .mt-1 { margin-top: 6px; }
.page .mt-2 { margin-top: .6rem; }
.page .my-1 { margin: .35rem 0; }
.page .my-2 { margin: .6rem 0; }
.page .my-3 { margin: 10px 0; }
.page .my-4 { margin: 12px 0; }
.page .break-all { word-break: break-all; }
.page .pre-line { white-space: pre-line; }

.page .pre {
  white-space: pre-wrap; background: var(--surface-subtle);
  border: 1px solid var(--border); padding: 12px; border-radius: var(--r-sm);
  max-height: 24rem; overflow: auto;
}

/* 帳票・画像・一括（旧） */
.page .issue-action { display: inline-block; margin-top: 4px; text-align: left; }
.page .issue-action summary { cursor: pointer; color: var(--link); font-size: var(--fs-sm); }
.page .issue-form { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.page .issue-form input[type="text"] { width: 12rem; }
.page .credit-form { margin: 12px 0; border: 1px solid var(--border); padding: 10px 12px; border-radius: var(--r-sm); }
.page .credit-form summary { cursor: pointer; font-weight: 700; }
.page .credit-form table { width: 100%; margin-top: 8px; }
.page .credit-form input[type="number"] { width: 6rem; }
.page .cards { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.page .cards .card { min-width: 9rem; max-width: none; padding: 12px 14px; }
.page .cards .card .num { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.page .cards .card.warn .num { color: var(--danger); }
.page .thumb-44 { width: 44px; height: 44px; object-fit: cover; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-subtle); }
.page .thumb-96 { width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-subtle); }
.page .thumb-empty {
  width: 96px; height: 96px; display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: var(--fs-xs); text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--r-md);
}
.page .media-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.page .plain-list { list-style: none; padding: 0; margin: 0; }

@media (max-width: 900px) {
  .page .grid2 { grid-template-columns: 1fr; }
  .page .filters input[type="text"] { width: 100%; }
}
@media print {
  .auth-brand, .topbar, .sidebar, .subbar { display: none !important; }
  .auth-shell { display: block; border: 0; box-shadow: none; }
  .main { margin: 0; padding: 0; }
}

/* --- 16-5. G1 components ------------------------------------------------ */
.skip-link {
  position: fixed; top: -48px; left: 8px; z-index: calc(var(--z-toast) + 1);
  padding: 8px 12px; font-size: var(--fs-sm); font-weight: 650;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  box-shadow: var(--sh-md);
}
.skip-link:focus { top: 8px; }

.field .help { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.5; }

.auth-panel .alert { margin-bottom: 16px; }
.auth-panel .input-affix .input { border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); }
.auth-panel .input-affix .password-toggle {
  width: 42px; height: 40px; flex: none;
  color: var(--text-3); background: var(--surface);
  border: 1px solid var(--border-strong); border-left: 0;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.auth-panel .input-affix .password-toggle:hover { background: var(--surface-subtle); color: var(--text); }

.meta-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 10px; }
.meta-list > div { padding: 8px 10px; background: var(--surface-subtle); border: 1px solid var(--border-soft); border-radius: var(--r-sm); }
.meta-list dt { margin: 0; font-size: var(--fs-2xs); font-weight: 700; color: var(--text-3); }
.meta-list dd { margin: 2px 0 0; font-weight: 650; }
.page .plain-list li { list-style: none; margin: 4px 0; }

/* ソリッドピルはトークンの濃色に揃える（白文字 4.97〜6.33:1） */
.pill-info { background: #1763c9; border-color: #1257ae; }
.pill-success { background: #17804b; border-color: #12663c; }
.pill-warning { background: #8a5300; border-color: #703f00; }
.pill-danger { background: #c0341d; border-color: #9f2a17; }
.pill-teal { background: #0d7a8c; border-color: #0a6271; }

/* 旧画面の表を横スクロールにする（static/app.js が枠を作る） */
.table-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.table-scroll > table { width: max-content; min-width: 100%; }

/* home のカードはグリッド幅いっぱいに使う（旧 .card の 460px 上限を外す） */
.page .grid-2 > .card { max-width: none; }
@media (max-width: 480px) { .meta-list { grid-template-columns: 1fr; } }

/* --- 17. 受注一覧（G2） ------------------------------------------------ */
/* 高さ950px以下では検索条件を畳む（1600x900で一覧の行数を確保する） */
@media (max-height: 950px) {
  .search-panel[data-search-panel] .sp-toggle { display: inline-flex; }
  .search-panel[data-search-panel]:not(.is-open) .card-body { display: none; }
}
.search-panel .sp-toggle .i { transition: rotate var(--dur); }
.search-panel.is-open .sp-toggle .i { rotate: 180deg; }
.search-panel .sp-applied { align-items: center; }
.search-panel .sp-clear { margin-left: auto; font-size: var(--fs-xs); white-space: nowrap; }
.search-panel .chip { white-space: nowrap; }
.check-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: var(--fs-md); font-weight: 500; }
.check-inline input { width: auto; height: auto; margin: 0; }
.flag-success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.page tr.is-alert-row td { background: #fff8f6; }
.pager .spacer { flex: 1; }
.action-help summary { cursor: pointer; white-space: nowrap; }
.action-help p { margin: 6px 0 0; max-width: 92ch; line-height: 1.65; }

/* 検索パネルは一覧幅いっぱい（旧 .card の 460px 上限を外す） */
.page .card.search-panel { max-width: none; }

/* --- 18. 受注詳細（G2） -------------------------------------------------- */
.detail-head .detail-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-head .detail-title h2 { font-size: 21px; font-weight: 800; margin: 0; }
.detail-preview-links { margin: -4px 0 10px; }
.detail-tabs { margin-bottom: 12px; }
.detail-main {
  padding: 2px 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.detail-main > h2 {
  margin: 18px 0 10px;
  padding-top: 14px;
  font-size: var(--fs-lg);
  border-top: 1px solid var(--border-soft);
}
.detail-main > h2:first-child { margin-top: 4px; padding-top: 0; border-top: 0; }
.detail-main .card { max-width: none; }
.detail-main .filters { margin: 10px 0; }
.detail-rail .card { max-width: none; }
.detail-rail .card-body { padding: 11px 12px; }
.detail-rail .meta-list { grid-template-columns: 1fr; gap: 7px; }
.detail-rail .meta-list > div { padding: 6px 9px; }
.rail-status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.stack-actions { display: flex; flex-direction: column; gap: 7px; }
.stack-actions .btn { width: 100%; justify-content: flex-start; }
@media (max-width: 1023px) {
  .detail-main { padding: 2px 10px 14px; }
}

/* 受注編集・メール（G2） */
.order-edit-card { max-width: none; }
.order-edit-card th { width: 11rem; }
.order-edit-card h2 { margin-top: 18px; }
.mail-resend { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mail-resend input[type="text"] { width: 12rem; }

/* 受注編集（G2 追補）: 電話注文の入力パターンに合わせた差分表示 */
.edit-diff { margin-left: 6px; font-weight: 650; color: var(--text-3); }
.edit-diff.is-up { color: var(--danger); }
.edit-diff.is-down { color: var(--success); }
.form-save .save-hint { margin-right: auto; color: var(--text-3); font-size: var(--fs-xs); }
.order-edit-items .w-price { width: 6.4rem; }
.order-edit-items .w-code { width: 4.8rem; }
.order-edit-items th, .order-edit-items td { padding-left: 6px; padding-right: 6px; }
.order-edit-items td { vertical-align: top; }
.order-edit-items .btn-sm { margin-left: 4px; }
.price-reason-box {
  margin: 12px 0; padding: 12px;
  background: var(--warning-bg); border: 1px solid var(--warning-border);
  border-radius: var(--r-sm);
}
.price-reason-box h3 { margin: 0 0 4px; font-size: var(--fs-md); font-weight: 750; }
.price-reason-box .form-grid { margin-top: 8px; }
.price-change-list { margin: 6px 0 0; padding-left: 1.2em; font-size: var(--fs-sm); }
.price-change-list li { margin: 2px 0; }
@media (max-width: 760px) {
  .form-save .save-hint { flex-basis: 100%; margin: 0 0 4px; }
}

/* アンカータブが固定ヘッダーの下に隠れないようにする */
.detail-main > h2[id] { scroll-margin-top: calc(var(--header-h) + var(--subbar-h) + 12px); }

/* --- 19. 電話注文（G3） -------------------------------------------------- */
.entry-tabs { margin-bottom: 12px; }
.entry-main { padding-bottom: 18px; }
.entry-section { border-top: 1px solid var(--border-soft); }
.entry-section:first-child { border-top: 0; }
.entry-section > h2 {
  margin: 0;
  padding: 16px 0 10px;
  font-size: var(--fs-lg);
  font-weight: 750;
  scroll-margin-top: calc(var(--header-h) + var(--subbar-h) + 12px);
}
.entry-main > .entry-section:first-child > h2 { padding-top: 6px; }
.entry-search { margin: 4px 0 10px; }
.entry-search .row { align-items: flex-end; }
.entry-customer { grid-template-columns: 1fr 1fr; }
.entry-readonly {
  min-height: 34px; margin: 0; padding: 7px 9px;
  background: var(--surface-subtle); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text-2);
}
.entry-confirm .alert { margin: 4px 0 10px; }
.entry-rail .card { max-width: none; }
.entry-total {
  display: flex; align-items: baseline; gap: 4px;
  font-size: 28px; font-weight: 800; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.entry-total .yen { font-size: var(--fs-md); font-weight: 600; color: var(--text-3); }
.entry-kv {
  display: flex; justify-content: space-between; gap: 10px;
  margin: 0; padding: 6px 0; border-top: 1px dashed var(--border-soft);
  font-size: var(--fs-sm); color: var(--text-2);
}
.entry-kv dt { margin: 0; font-weight: 500; }
.entry-kv dd { margin: 0; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.entry-kv-total { border-bottom: 1px solid var(--border-soft); }
.entry-warn {
  display: flex; align-items: center; gap: 5px;
  margin: 9px 0 0; padding: 7px 9px;
  font-size: var(--fs-xs); font-weight: 650;
  color: var(--danger); background: var(--danger-bg);
  border: 1px solid var(--danger-border); border-radius: var(--r-sm);
}
.entry-warn .i { width: 13px; height: 13px; }
@media (max-width: 900px) {
  .entry-customer { grid-template-columns: 1fr; }
}

/* inline style は CSP（style-src 'self'）で止まるので、余白はクラスで持つ。 */
.bulk-result-lead { margin: 0 0 8px; }
.bulk-result-note { margin: 8px 0 0; }

/* 受注登録の下書き（S-21 / D-242）。 */
.draft-delete-form { display: inline; }
.draft-empty { margin: 0; }
.draft-done { margin-top: 8px; }
.draft-note { margin: 8px 0 0; }

/* --- 20. G4 一覧の共通調整 ---------------------------------------------- */
/* .search-panel 以外でも sp-grid を使えるようにする（商品・見積） */
.sp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px 12px; }
.sp-grid .span2 { grid-column: span 2; }
@media (max-width: 1240px) { .sp-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .sp-grid { grid-template-columns: 1fr; }
  .sp-grid .span2 { grid-column: auto; }
}
.products-table { font-size: 12.5px; }
.products-table th, .products-table td { padding: 6px 8px; }
.products-table .thumb-44 { width: 36px; height: 36px; }
.table-scroll > table.products-table { width: 100%; min-width: 1120px; }
.products-table .num, .products-table .flag, .products-table td:last-child { white-space: nowrap; }
.sp-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.sp-foot .spacer { flex: 1; }

/* 商品一覧: 詳細検索（ステータス複数チェック） */
.advanced-search { margin-top: 12px; border-top: 1px solid var(--border-soft); padding-top: 10px; }
.advanced-search > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-2);
  list-style-position: inside;
}
.advanced-search[open] > summary { margin-bottom: 10px; }
.status-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-top: 4px; }

.page details.card { max-width: none; }

/* フォームの保存バー（カード下部にsticky） */
.form-save {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; justify-content: flex-end; gap: 8px; align-items: center;
  margin: 16px -15px -13px; padding: 10px 15px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(4px);
}
.form-save--static { position: static; margin: 16px -13px 0; }
.page pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ログインのパスワード表示ボタン（input-affix 内で高さを合わせる） */
.auth-panel .input-affix .password-toggle { height: 34px; min-height: 0; padding: 0; align-self: center; }

/* ページヘッドの操作は右端に寄せる（legacy .page .actions の margin を上書き） */
.page .page-head .actions { margin: 0 0 0 auto; }
@media (max-width: 760px) {
  .page .page-head .actions { margin-left: 0; }
}

/* 電話注文: 商品検索モーダル（D-137/D-139。入力途中のフォームを保持する） */
.product-dialog {
  width: min(920px, 96vw);
  max-height: 86vh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(16, 24, 40, 0.24);
}
.product-dialog::backdrop {
  background: rgba(16, 24, 40, 0.45);
}
.product-dialog-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.product-dialog-head h2 {
  margin: 0;
  font-size: 18px;
}
.product-dialog-head .btn {
  margin-left: auto;
}
.product-dialog .entry-search {
  padding: 16px 20px 0;
}
.product-dialog-results {
  max-height: 60vh;
  padding: 12px 20px 20px;
  overflow: auto;
}

.product-dialog .actions {
  padding: 12px 20px 20px;
}

/* 電話注文: 品番入力（D-137/D-139） */
.entry-code {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.entry-code .field {
  min-width: 240px;
}
.sku-code-result {
  margin: 8px 0 14px;
}
.sku-preview,
.sku-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.sku-preview {
  border-color: var(--primary);
}
.sku-preview-price,
.sku-card-price {
  margin-left: auto;
  font-weight: 700;
}
.sku-card {
  margin-top: 6px;
}
.sku-card-main {
  flex: 1;
}
.sku-card-name {
  font-weight: 600;
}
.sku-empty {
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-2);
}

/* 商品モーダル: 商品単位のまとまり・フッター小計 */
.product-group {
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.product-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-subtle);
}
.product-group-name {
  font-weight: 600;
}
.product-group-price {
  margin-left: auto;
  font-weight: 700;
}
.product-group-skus {
  padding: 4px 12px 8px;
}
.product-group-skus .sku-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--border-soft);
}
.product-group-skus .sku-row .num {
  margin-left: auto;
}
.product-dialog-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border-soft);
  text-align: right;
  font-weight: 600;
}

/* 商品モーダル: 商品単位のまとまり・フッター小計 */
.product-group {
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.product-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-subtle);
}
.product-group-name {
  font-weight: 600;
}
.product-group-price {
  margin-left: auto;
  font-weight: 700;
}
.product-group-skus {
  padding: 4px 12px 8px;
}
.product-group-skus .sku-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--border-soft);
}
.product-group-skus .sku-row .num {
  margin-left: auto;
}
.product-dialog-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border-soft);
  text-align: right;
  font-weight: 600;
}

/* 電話注文: 商品モーダルの数量入力・追加後の強調 */
.product-group-skus .sku-row .sku-add {
  display: flex;
  align-items: center;
  gap: 6px;
}
.product-group-skus .sku-row .sku-qty {
  width: 64px;
  padding: 4px 6px;
  text-align: right;
}
.product-dialog .product-dialog-error {
  margin: 8px 20px 0;
}
.page tr.is-added td {
  background: var(--success-bg);
  transition: background .6s;
}

/* 電話注文: 登録前の確認ダイアログ */
.entry-confirm-dialog {
  width: min(780px, 96vw);
}
.entry-confirm-body {
  max-height: 66vh;
  padding: 14px 20px 18px;
  overflow: auto;
}
.entry-confirm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.entry-confirm-box {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.entry-confirm-box h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
}
.entry-confirm-box p {
  margin: 0 0 4px;
}
.entry-confirm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.entry-confirm-table th,
.entry-confirm-table td {
  padding: 5px 6px;
  border-top: 1px solid var(--border-soft);
  text-align: left;
}
.entry-confirm-table th {
  color: var(--text-3);
  font-weight: 600;
}
.entry-confirm-table .num {
  text-align: right;
  white-space: nowrap;
}
.entry-confirm-warnings {
  margin: 0;
  padding-left: 18px;
  color: var(--danger);
  font-size: 12.5px;
}
.entry-confirm-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
@media (max-width: 700px) {
  .entry-confirm-grid { grid-template-columns: 1fr; }
}

/* 電話注文: 下書きの復元バナー */
.entry-draft-banner {
  display: flex;
  align-items: center;
  gap: 10px;
}
.entry-draft-banner .btn {
  margin-left: auto;
  white-space: nowrap;
}

/* ---------- 値の一括登録ダイアログ（D-224） ---------- */
.bulk-dialog { width: min(900px, 96vw); overflow: auto; }
.bulk-dialog-body { display: grid; grid-template-columns: 1.05fr 1fr; gap: 16px; padding: 14px 20px 2px; }
.bulk-dialog-body.is-single { grid-template-columns: 1fr; }
.bulk-dialog textarea { min-height: 220px; line-height: 1.7; }
.bulk-preview-head { display: flex; align-items: center; padding-bottom: 6px;
  font-size: var(--fs-xs); font-weight: 700; color: var(--text-2); }
.bulk-preview-head span { margin-left: auto; font-weight: 500; color: var(--text-3); }
.bulk-lines { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border);
  border-radius: var(--r-sm); max-height: 250px; overflow: auto; }
.bulk-lines li { display: flex; align-items: center; gap: 8px; padding: 4px 9px;
  border-bottom: 1px solid var(--border-soft); font-size: var(--fs-sm); }
.bulk-lines li:last-child { border-bottom: 0; }
.bulk-lines .ln { width: 18px; text-align: right; font-size: var(--fs-2xs);
  color: var(--text-3); font-variant-numeric: tabular-nums; }
.bulk-lines .v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-lines .st { flex: none; font-size: var(--fs-2xs); font-weight: 700;
  border-radius: var(--r-xs); padding: 1px 6px; border: 1px solid transparent; }
.bulk-lines .st-new { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.bulk-lines .st-existing { color: var(--text-3); background: var(--neutral-bg); border-color: var(--border); }
.bulk-lines .st-duplicate { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.bulk-lines .st-empty { color: var(--text-3); background: var(--surface); border-color: var(--border-soft); }
.bulk-lines .st-error { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.bulk-lines li.is-new { background: #f4fbf7; }
.bulk-lines li.is-error { background: #fdf5f2; }
.bulk-counts { padding: 7px 9px; border: 1px solid var(--border); border-top: 0;
  border-radius: 0 0 var(--r-sm) var(--r-sm); font-size: var(--fs-sm);
  font-weight: 650; background: var(--surface-subtle); }
.bulk-dup-note { margin-top: 6px; font-size: var(--fs-xs); color: var(--text-3); }
.bulk-dialog-options { display: flex; gap: 26px; flex-wrap: wrap; padding: 12px 20px 0; }
.bulk-dialog-options fieldset { border: 0; padding: 0; margin: 0; }
.bulk-dialog-options legend { margin-bottom: 5px; font-size: var(--fs-xs);
  font-weight: 700; color: var(--text-2); }
.bulk-dialog-options label { display: inline-flex; align-items: center; gap: 5px;
  margin: 0 14px 4px 0; font-size: var(--fs-sm); }
.bulk-dialog-note { padding: 10px 20px 0; font-size: var(--fs-sm); color: var(--text-2); }
.bulk-dialog-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px 16px; }
.bulk-dialog-foot .bulk-error { margin-right: auto; font-size: var(--fs-sm); color: var(--danger); }

/* ---------- バリエーションのタブ（D-224） ---------- */
.var-tabs { display: inline-flex; gap: 2px; padding: 3px; margin: 2px 0 14px;
  background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r-md); }
.var-tabs a { display: inline-flex; align-items: center; gap: 7px; height: 34px;
  padding: 0 15px; border-radius: var(--r-sm); font-size: var(--fs-md);
  font-weight: 600; color: var(--text-2); }
.var-tabs a:hover { color: var(--text); text-decoration: none; }
.var-tabs a.is-active { background: var(--surface); color: var(--primary-text);
  font-weight: 700; box-shadow: var(--sh-xs); }
.var-tabs .i { width: 14px; height: 14px; }
.var-tabs .n { font-size: var(--fs-xs); font-weight: 700; color: var(--text-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-full);
  padding: 0 7px; line-height: 17px; font-variant-numeric: tabular-nums; }
.var-tabs a.is-active .n { color: var(--primary-text); background: var(--primary-50);
  border-color: var(--primary-100); }

/* ---------- オプション値の表（D-224） ---------- */
.options-table { table-layout: fixed; }
.options-table th:nth-child(1) { width: 38%; }
.options-table th:nth-child(2) { width: 16%; }
.options-table th:nth-child(3) { width: 14%; }
.options-table td { vertical-align: middle; }
.options-table .t-num { text-align: right; }

/* ---------- 軸マップと軸見出し（D-224） ---------- */
.axis-map { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: -4px 0 14px; padding: 8px 11px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-xs); }
.axis-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: var(--r-full); color: var(--text);
  background: var(--surface-subtle); font-size: var(--fs-sm); }
.axis-chip:hover { border-color: var(--primary-200); background: var(--primary-50); text-decoration: none; }
.axis-chip .k { font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .04em;
  color: var(--primary-text); background: var(--primary-50); border: 1px solid var(--primary-100);
  border-radius: var(--r-xs); padding: 0 5px; }
.axis-chip b { font-weight: 700; }
.axis-chip .v { font-size: var(--fs-xs); color: var(--text-3); }
.axis-map .arrow { color: var(--border-strong); font-size: var(--fs-sm); }
.axis-map .spacer { flex: 1; }
.axis-map .combo { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.axis-map .miss { margin-left: 8px; color: var(--warning); font-weight: 700; }

.axis-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; flex-wrap: wrap; }
.axis-head h2 { margin: 0; font-size: var(--fs-xl); font-weight: 750; }
.axis-badge { font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .04em;
  color: var(--text-2); background: var(--neutral-bg); border: 1px solid var(--border);
  border-radius: var(--r-xs); padding: 1px 6px; }
.axis-meta { font-size: var(--fs-xs); color: var(--text-3); }
.filter-row { margin: 4px 0 10px; }

/* ---------- 組み合わせマトリクス（D-224） ---------- */
.matrix-card { margin-bottom: 13px; }
.matrix-wrap { position: relative; overflow: auto; max-height: 460px; padding: 12px 13px; }
.matrix { border-collapse: separate; border-spacing: 4px; width: auto; }
.matrix th { position: sticky; top: 0; z-index: 1; padding: 4px 8px;
  background: var(--surface); font-size: var(--fs-xs); font-weight: 700;
  color: var(--text-2); text-align: left; white-space: nowrap; }
.matrix tbody th { left: 0; z-index: 2; }
.matrix td { padding: 0; }
.mx { display: inline-grid; place-items: center; width: 52px; height: 30px;
  border-radius: var(--r-sm); font-size: 13px; }
.mx.on { background: var(--primary-50); color: var(--primary-text); border: 1px solid var(--primary-100); }
.mx.on.is-hidden { background: var(--surface-sunken); color: var(--text-3); border-color: var(--border); }
.mx.add { border: 1px dashed var(--border-strong); color: var(--text-3); background: transparent; }
.mx.add:hover { border-color: var(--primary); color: var(--primary-text); background: var(--primary-50); }
.mx.add:disabled { opacity: .4; }
.matrix .miss { color: var(--warning); font-weight: 700; }
.matrix-card .card-foot { border-top: 1px solid var(--border-soft); }
.matrix-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.matrix-legend .dot { display: inline-grid; place-items: center; width: 16px; height: 16px;
  margin-right: 4px; border-radius: 3px; font-size: 10px; font-style: normal;
  vertical-align: -3px; }
.matrix-legend .dot.on { background: var(--primary-50); border: 1px solid var(--primary-200); }
.matrix-legend .dot.on::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.matrix-legend .dot.off { background: var(--surface-sunken); border: 1px solid var(--border); }
.matrix-legend .dot.off::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.matrix-legend .dot.add { border: 1px dashed var(--border-strong); color: var(--text-3); }

/* ---------- 軸の詳細セクション（D-224） ---------- */
.axis-advanced { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.axis-advanced > summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 650; color: var(--text-3); }
.axis-advanced > summary:hover { color: var(--text); }
.axis-advanced[open] > summary { margin-bottom: 6px; }
.axis-advanced p { margin-top: 8px; }

/* 電話注文: 品番候補の追加数量 */
.sku-add-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.sku-qty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.sku-qty .input {
  width: 64px;
  min-height: 30px;
  padding: 3px 6px;
  text-align: right;
}

/* ---------- バリエーションの2カラム・保存バー（D-226） ---------- */
.variations-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 16px; align-items: start;
}
.variations-main { min-width: 0; }
.variations-main > form > .card { margin-bottom: 12px; }
.variations-side {
  min-width: 0;
  position: sticky; top: calc(var(--header-h) + var(--subbar-h) + 12px);
}
.variations-side .matrix-card { margin-bottom: 0; }
.variations-side .matrix-wrap {
  max-height: calc(100vh - var(--header-h) - var(--subbar-h) - 210px);
}
@media (max-width: 1360px) {
  .variations-layout { grid-template-columns: 1fr; }
  .variations-side { position: static; order: -1; }
  .variations-side .matrix-wrap {
    max-height: min(52vh, 520px);
  }
}

/* マトリクスのセルが多いときのリスト表示 */
.matrix-list-wrap { padding: 8px 10px; }
.matrix-list { display: flex; flex-direction: column; gap: 4px; }
.mx-line { display: grid; grid-template-columns: minmax(64px, 104px) 1fr; gap: 6px; align-items: start; }
.mx-line-k { font-size: var(--fs-xs); font-weight: 700; color: var(--text-2);
  padding-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-line-cells { display: flex; flex-wrap: wrap; gap: 3px; }
.mx-line-cells .mx { width: 34px; height: 28px; font-size: 12px; }
.matrix-too-big { padding: 14px 13px; }
.matrix-too-big p { margin: 0 0 6px; font-size: var(--fs-sm); color: var(--text-2); }

/* 未作成は欠陥ではないので、警告色ではなく淡色で事実だけを示す */
.axis-map .miss, .matrix .miss { color: var(--text-3); font-weight: 600; }
.matrix-card .card-head .sub .miss { color: var(--text-3); }

/* 使用中の値の削除は鍵アイコン。行全体は淡色にしない */
.lock-note { display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; color: var(--text-3); border-radius: var(--r-xs); }
.lock-note .i { width: 14px; height: 14px; }
.options-table th:nth-child(3), .options-table th:nth-child(4) { width: 12%; }
.options-table .t-actions { text-align: right; }
.options-table .t-del { text-align: center; }

/* 画面下に固定する保存バー */
.variations-savebar {
  position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 8px 18px;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 18px rgba(16, 24, 40, 0.06);
  backdrop-filter: blur(6px);
}
body.is-sidebar-collapsed .variations-savebar { left: var(--sidebar-w-mini); }
.variations-savebar .spacer { flex: 1; }
.save-state { display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-sm); font-weight: 650; color: var(--text-3); }
.save-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); }
.variations-savebar.is-dirty .save-state { color: var(--warning); }
.variations-savebar.is-dirty .save-state::before { background: var(--warning); }
@media (max-width: 760px) {
  .variations-savebar { left: 0; padding: 8px 12px; }
  .variations-savebar .save-state { font-size: var(--fs-xs); }
}

/* 値の追加はプレビュー付きの1導線に統一（D-226） */
.axis-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 10px 0 2px; }
.axis-actions .small { margin-left: 2px; }
.chip-checks { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px;
  margin: 0; padding: 4px 10px; border: 1px solid var(--border);
  border-radius: var(--r-full); background: var(--surface-subtle);
  font-size: var(--fs-sm); font-weight: 650; cursor: pointer; }
.chip-check input { width: auto; height: auto; margin: 0; accent-color: var(--primary); }
.chip-check:has(input:checked) { border-color: var(--primary-200);
  background: var(--primary-50); color: var(--primary-text); }
.matrix-legend .matrix-note { flex-basis: 100%; margin-top: 2px; color: var(--text-3); }
.var-tabs a, .var-tabs .n { white-space: nowrap; }
.matrix { table-layout: fixed; }
.matrix thead th, .matrix tbody th { white-space: normal; }
.mx-th { display: block; width: 52px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; line-height: 1.25; }
.mx-th-row { width: 78px; }
.matrix td { width: 50px; }
.options-table { width: 100%; }
.options-table th:nth-child(1) { width: 46%; }
.options-table th:nth-child(2) { width: 16%; }
.options-table th:nth-child(3) { width: 18%; }
.options-table th:nth-child(4) { width: 20%; }
.variations-layout:not(.has-matrix) { grid-template-columns: 1fr; }
.variations-layout:not(.has-matrix) .variations-side { display: none; }
.matrix th { padding-left: 5px; padding-right: 5px; }
.mx-th { white-space: normal; overflow: visible; text-overflow: clip;
  overflow-wrap: anywhere; line-height: 1.2; }
.mx-th-row { width: 82px; }
.variations-side .card { max-width: none; }
@media (max-width: 1360px) {
  .variations-side { max-width: 460px; }
}
@media (max-width: 820px) {
  .variations-side { max-width: none; }
}
.matrix { width: max-content; }
.matrix th:first-child { width: 96px; }
.matrix th:not(:first-child), .matrix td { width: 68px; }
.options-scroll { overflow-x: auto; }
@media (max-width: 760px) {
  .options-scroll > table { min-width: 620px; }
}
.scroll-hint { display: none; }
@media (max-width: 760px) {
  .scroll-hint { display: block; margin: 4px 0 0; font-size: var(--fs-xs);
    color: var(--text-3); }
}
.matrix-status { flex-basis: 100%; margin-top: 2px; font-size: var(--fs-xs);
  color: var(--text-2); }

/* ---------- カテゴリ選択ツリー（D-228） ---------- */
.cat-picker {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); overflow: hidden;
}
.cat-picker-head {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
}
.cat-search { flex: 1; margin: 0; }
.cat-search input { width: 100%; }
.cat-selected-count { font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; }
.cat-selected-count b { color: var(--text); font-variant-numeric: tabular-nums; }
.cat-picker-body {
  max-height: 460px; overflow: auto; padding: 6px 8px;
  border-right: 1px solid var(--border-soft);
}
.cat-tree { list-style: none; margin: 0; padding-left: 16px; }
.cat-picker-body > .cat-tree { padding-left: 0; }
.cat-node[hidden] { display: none; }
.cat-check {
  display: flex; align-items: center; gap: 7px;
  margin: 0; padding: 3px 5px; border-radius: var(--r-xs);
  font-size: var(--fs-sm); font-weight: 500; cursor: pointer;
}
.cat-check:hover { background: var(--surface-hover); }
.cat-check input { width: auto; height: auto; margin: 0; accent-color: var(--primary); }
.cat-count {
  margin-left: auto; font-size: var(--fs-2xs); color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.cat-selected { background: var(--surface-subtle); padding: 6px 8px; overflow: auto; max-height: 460px; }
.cat-selected-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; font-size: var(--fs-xs); font-weight: 700; color: var(--text-2);
  margin-bottom: 4px;
}
.cat-selected-list { list-style: none; margin: 0; padding: 0; }
.cat-selected-list li {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 3px 0; border-bottom: 1px solid var(--border-soft);
  font-size: var(--fs-xs);
}
.cat-selected-path { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--text-2); }

/* ---------- カテゴリマスター（D-228） ---------- */
.category-admin-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px; align-items: start;
}
.category-add-card { max-width: none; }
.cat-admin-tree { list-style: none; margin: 0; padding-left: 18px; }
.category-admin-layout .card-body > .cat-admin-tree { padding-left: 0; }
.cat-admin-node[hidden] { display: none; }
.cat-admin-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 6px; border-radius: var(--r-xs);
}
.cat-admin-row:hover { background: var(--surface-hover); }
.cat-admin-name { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; }
.cat-admin-name > span:first-child { font-weight: 650; }
.cat-admin-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.cat-admin-actions form { margin: 0; }

/* ---------- 商品編集の画像（D-228） ---------- */
.edit-media-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 8px; }
.edit-media-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 8px; border: 1px solid var(--border-soft); border-radius: var(--r-sm);
}
.edit-media-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.edit-media-actions form { margin: 0; }
/* 画像の並び替え・一括削除（D-234） */
.image-file-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%;
}
.image-drag-handle {
  flex: none; color: var(--text-3); cursor: grab; user-select: none;
  font-size: 16px; line-height: 1; padding: 0 2px;
}
.edit-media-row[draggable="true"] { cursor: grab; }
.edit-media-row.is-dragging { opacity: 0.45; }
.edit-media-row.drop-before { box-shadow: 0 -2px 0 var(--primary); }
.edit-media-row.drop-after { box-shadow: 0 2px 0 var(--primary); }
.image-bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 8px; padding: 5px 8px;
  background: var(--surface-subtle); border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
}
.image-select { flex: none; width: auto; height: auto; margin: 0 2px; }
.image-upload-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.image-upload-form input[type="file"] { max-width: 360px; }
.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; margin: 10px 0 0;
}
.media-cell {
  border: 1px solid var(--border-soft); border-radius: var(--r-sm);
  padding: 6px; background: var(--surface-subtle);
}
.media-cell .thumb-96 { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
@media (max-width: 1100px) {
  .cat-picker { grid-template-columns: 1fr; }
  .cat-picker-body { border-right: 0; border-bottom: 1px solid var(--border-soft); max-height: 360px; }
  .cat-selected { max-height: 220px; }
  .category-admin-layout { grid-template-columns: 1fr; }
}
.page .cat-admin-tree, .page .cat-tree, .page .cat-selected-list { list-style: none; }
.edit-dirty { margin-right: auto; font-size: var(--fs-sm); font-weight: 650;
  color: var(--warning); }
.edit-dirty::before { content: "●"; margin-right: 5px; }
.cat-public-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 4px 0 10px; padding: 6px 8px; background: var(--surface-subtle);
  border: 1px solid var(--border-soft); border-radius: var(--r-sm); }
.cat-admin-select { flex: none; width: auto; height: auto; margin: 0 2px 0 0; }

/* --- 17b. 受注一覧: ステータスレール（S-20） ---------------------------- */
.page .card.rail-card,
.page .card.search-panel { max-width: none; padding: 0; }
.page .card.rail-card { margin-bottom: 6px; }
.page .card.rail-card h2 { margin: 0; }
.rail-card .card-head { padding: 5px 13px; border-bottom: 1px solid var(--border-soft); }
.rail-card .card-head h2 { font-size: var(--fs-md); }
.rail-card .card-head .sub { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); }
.rail-help { font-size: var(--fs-xs); color: var(--text-3); }
.rail-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs); color: var(--text-3); cursor: pointer; white-space: nowrap;
}
.rail-toggle input { width: auto; height: auto; margin: 0; accent-color: var(--primary); }
.rail-wrap { padding: 6px 13px 7px; }
.rail-scroll { overflow-x: auto; scrollbar-width: thin; }
/* 段の列は中身に合わせた固定幅で左詰めにする。
   flex: 1 で残り幅を配分すると、チップの右に余白が溜まり
   段と段の間が広く見えるため。 */
.status-rail { display: flex; align-items: stretch; gap: 0; width: 100%; min-width: max-content; }
.stage { flex: 0 0 auto; display: flex; flex-direction: column; gap: 5px; width: 118px; }
.stage-accepted { --stage-color: #4a90d9; width: 118px; }
.stage-payment  { --stage-color: #e8940f; width: 124px; }
.stage-stock    { --stage-color: #b26a00; width: 182px; }
.stage-ready    { --stage-color: #1893a8; width: 168px; }
.stage-docs     { --stage-color: #6b5bd2; width: 142px; }
.stage-done     { --stage-color: #2ea36b; width: 112px; }
.stage-head {
  display: flex; align-items: center; gap: 6px;
  width: 100%; height: 19px; padding: 0 2px;
  color: var(--text-3); font-size: var(--fs-2xs); font-weight: 750;
  letter-spacing: .06em; text-align: left; text-decoration: none; white-space: nowrap;
}
.stage-head::before {
  content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%;
  background: var(--stage-color); box-shadow: 0 0 0 3px var(--surface-sunken);
}
.stage-head:hover { color: var(--text); text-decoration: none; }
.stage-head:hover::before { box-shadow: 0 0 0 3px var(--primary-50); }
.stage-body { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px 3px; }
.status-chip {
  display: flex; align-items: center; gap: 6px;
  width: auto; min-height: 23px; padding: 2px 7px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text-2);
  font-size: 11.5px; font-weight: 600; line-height: 1.25;
  text-align: left; text-decoration: none;
  transition: background var(--dur), border-color var(--dur), color var(--dur), box-shadow var(--dur);
}
.status-chip:hover {
  background: var(--surface-subtle); border-color: var(--chip-tone, var(--border-strong));
  color: var(--text); text-decoration: none;
}
.status-chip .chip-dot {
  width: 6px; height: 6px; flex: none; border-radius: 50%;
  background: var(--chip-tone, var(--text-3));
}
.status-chip .chip-name { min-width: 0; }
.status-chip .chip-count {
  margin-left: auto; flex: none; min-width: 22px; padding: 0 5px;
  font-size: var(--fs-2xs); font-weight: 700; text-align: center;
  color: var(--text-2); background: var(--surface-sunken);
  border: 1px solid var(--border-soft); border-radius: var(--r-full);
  font-variant-numeric: tabular-nums;
}
/* 0件でも文字のコントラストを確保する（opacity で薄めると 2.57:1 まで落ちる）。
   背景・ドット・件数で「0件」を控えめに見せる。 */
.status-chip.is-zero {
  background: var(--surface-subtle);
  border-color: var(--border-soft);
  color: var(--text-3);
}
.status-chip.is-zero .chip-dot { opacity: .45; }
.status-chip.is-zero .chip-count { color: var(--text-3); background: var(--surface); }
.status-chip.is-zero:hover {
  background: var(--surface); border-color: var(--border-strong); color: var(--text);
}
.status-chip.is-selected {
  background: var(--primary-50); border-color: var(--primary-200);
  color: var(--primary-text); box-shadow: inset 0 0 0 1px var(--primary-100);
}
.status-chip.is-selected .chip-count {
  color: #fff; background: var(--primary); border-color: var(--primary);
}
.status-chip[data-tone="info"]    { --chip-tone: #4a90d9; }
.status-chip[data-tone="warning"] { --chip-tone: #e8940f; }
.status-chip[data-tone="stock"]   { --chip-tone: #b26a00; }
.status-chip[data-tone="teal"]    { --chip-tone: #1893a8; }
.status-chip[data-tone="docs"]    { --chip-tone: #6b5bd2; }
.status-chip[data-tone="success"] { --chip-tone: #2ea36b; }
.status-chip[data-tone="neutral"] { --chip-tone: #7a8598; }
.status-chip[data-tone="danger"]  { --chip-tone: #c0341d; }
.stage-sep {
  flex: none; width: 16px; align-self: flex-start; margin-top: 2px;
  display: grid; place-items: center; color: var(--border-strong);
}
.stage-sep .i { width: 12px; height: 12px; stroke-width: 2.2; }
.stage[hidden] + .stage-sep { display: none; }
.rail-side {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 4px; padding-top: 5px; border-top: 1px dashed var(--border);
}
.card-head .spacer, .sp-applied .spacer, .rail-side .spacer { flex: 1; }
.rail-side .side-label {
  font-size: var(--fs-2xs); font-weight: 750; letter-spacing: .06em;
  color: var(--text-3); margin-right: 1px;
}
.rail-side .side-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
/* ラベルとチップをひとまとまりにして、折り返しでラベルだけ取り残されないようにする。 */
.rail-side .side-group { display: inline-flex; align-items: center; gap: 6px; }
.rail-side .status-chip {
  width: auto; min-height: 24px; font-size: var(--fs-xs);
  padding: 3px 7px; background: var(--surface-subtle);
}
.rail-side .status-chip .chip-count { min-width: 20px; }
/* レール左の下書き（点線・鉛筆）。0件ならテンプレート側で出さない。 */
.draft-chip {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 24px; padding: 2px 8px;
  background: var(--surface); border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm); color: var(--text-2);
  font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
}
.draft-chip:hover {
  border-color: var(--primary); background: var(--primary-50); color: var(--primary-text);
}
.draft-chip .i { width: 13px; height: 13px; color: var(--text-3); }
.draft-chip:hover .i { color: var(--primary-text); }
.draft-chip .chip-count {
  min-width: 20px; padding: 0 5px; font-size: var(--fs-2xs); font-weight: 700;
  line-height: 1.5; text-align: center; color: var(--text-2);
  background: var(--surface-sunken); border: 1px solid var(--border-soft);
  border-radius: var(--r-full); font-variant-numeric: tabular-nums;
}
/* 下書きドロワー（/orders/drafts を開いたときだけ読み込む） */
.drawer-head .spacer { flex: 1; }
body.has-drawer { overflow: hidden; }
.draft-drawer-lead { margin: 0 0 9px; }
/* .page ul の disc / padding を打ち消す（詳細度を上げる）。 */
.page .draft-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.draft-item {
  border: 1px solid var(--border-soft); border-radius: var(--r-sm);
  padding: 8px 10px; background: var(--surface);
}
.draft-item-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.draft-item-main { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; min-width: 0; }
.draft-item-name { font-weight: 650; font-size: var(--fs-sm); }
.draft-item-phone { font-variant-numeric: tabular-nums; }
.draft-item-meta { margin-left: auto; white-space: nowrap; font-size: var(--fs-2xs); }
.draft-item-actions { display: flex; gap: 4px; justify-content: flex-end; margin-top: 6px; }
.draft-list-done .draft-item { border-style: dashed; background: var(--surface-subtle); }
.side-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.rail-scroll { min-width: 0; }
/* 検索条件は常に開閉可能にし、既定は閉じる（app.js）。 */
.search-panel[data-search-panel] .sp-toggle { display: inline-flex; }
.search-panel[data-search-panel]:not(.is-open) .card-body { display: none; }
.search-panel .sp-applied { padding: 0 13px; margin: 8px 0; }
.search-panel .card-body { padding: 10px 13px 11px; }
.search-panel .sp-foot { margin-top: 8px; padding-top: 8px; }

@media (max-width: 1100px) {
  .rail-help { display: none; }
  /* 商品詳細など、操作ボタンが多い画面でページ全体が横にはみ出すのを防ぐ。 */
  .page-head { flex-wrap: wrap; }
  .page-head .actions { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
  /* 受注一覧のステータスレールは横スクロールできることを見せる。 */
  .rail-scroll { padding-bottom: 2px; }
  .rail-scroll::-webkit-scrollbar { height: 8px; }
  .rail-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
  .rail-scroll::-webkit-scrollbar-track { background: transparent; }
}
@media (max-width: 760px) {
  .rail-wrap { padding: 8px 9px 10px; }
  .status-rail { flex-wrap: wrap; min-width: 0; gap: 6px; }
  .stage, .stage-stock, .stage-ready { flex: 1 1 calc(50% - 6px); min-width: 0 !important; }
  .stage-sep { display: none; }
  .rail-side .side-sep { display: none; }
  .rail-side .spacer { flex: 1 1 100%; height: 0; }
  .search-panel .card-head .muted.small { display: none; }
  .status-chip { font-size: 11px; }
}

/* 画像のaltと商品間移動（D-239） */
.image-alt { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 3px 0 4px; }
.image-alt-input { max-width: 380px; }

/* コレクション画像（D-240） */
.collection-image-preview {
  max-width: 340px; width: 100%; height: auto;
  border: 1px solid var(--border-soft); border-radius: var(--r-sm);
}

/* 受注一覧の一括ステータス変更（S-20 / D-242） */
.c-check { width: 2.2rem; text-align: center; }
.c-check input { width: 16px; height: 16px; }
.bulk-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin: 0 0 10px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--primary);
  border-radius: var(--r); box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}
.bulk-bar .hint { color: var(--text-3); font-size: var(--fs-xs); }
.bulk-bar[hidden] { display: none; }


/* ==========================================================================
   受注一覧: ステータスチェック・行色・詳細検索・伝票（2026-11-18）
   ========================================================================== */

/* ステータスは「チェック＋名前＋件数リンク」。チップ全体はリンクにしない。 */
.status-chip { cursor: default; }
.status-chip .status-check {
  width: auto; height: auto; margin: 0; flex: none;
  accent-color: var(--primary); cursor: pointer;
}
.status-chip .chip-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
}
.status-chip .chip-count { text-decoration: none; }
.status-chip .chip-count:hover { text-decoration: none; color: var(--text); }
.status-chip:focus-within { outline: 2px solid var(--primary); outline-offset: 1px; }
.status-chip.is-selected .chip-count { color: #fff; background: var(--primary); border-color: var(--primary); }

/* ステータス色の行。tint は薄くして文字のコントラストを保つ。 */
.orders-table tbody tr[data-tone="info"]    { --row-bg: #eef5fc; --row-bg-hover: #e3eefb; }
.orders-table tbody tr[data-tone="warning"] { --row-bg: #fdf5e8; --row-bg-hover: #faecd5; }
.orders-table tbody tr[data-tone="stock"]   { --row-bg: #fbf3e6; --row-bg-hover: #f7e9d2; }
.orders-table tbody tr[data-tone="teal"]    { --row-bg: #eaf7f9; --row-bg-hover: #dff2f5; }
.orders-table tbody tr[data-tone="docs"]    { --row-bg: #f1effb; --row-bg-hover: #e8e4f7; }
.orders-table tbody tr[data-tone="success"] { --row-bg: #eaf7f0; --row-bg-hover: #dff1e7; }
.orders-table tbody tr[data-tone="neutral"] { --row-bg: #f5f6f8; --row-bg-hover: #eef0f3; }
.orders-table tbody tr[data-tone="danger"]  { --row-bg: #fdf0ed; --row-bg-hover: #fbe5e0; }
.orders-table tbody tr[data-tone] { background: var(--row-bg); }
.orders-table tbody tr[data-tone]:hover { background: var(--row-bg-hover); }
.orders-table tbody tr.is-alert-row { box-shadow: inset 3px 0 0 var(--danger); }
.orders-table tbody tr.is-alert-row td { background: transparent; }
.orders-table tbody tr:has(.bulk-check:checked) { box-shadow: inset 3px 0 0 var(--primary); }
.orders-table { min-width: 1120px; }

.note-flag { display: inline-flex; align-items: center; gap: 3px; color: var(--text-2); font-size: var(--fs-xs); }
.note-cell, .tracking-cell { white-space: nowrap; }
.tracking-cell .mono { font-size: var(--fs-xs); }

.carrier-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 19px; padding: 0 4px; margin-right: 4px;
  border: 1px solid; border-radius: 3px;
  font-size: 10px; font-weight: 750; line-height: 1;
  cursor: pointer;
}
.carrier-badge:hover { filter: brightness(.96); }
.carrier-badge:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.carrier-sagawa { color: #0b4f9c; background: #eaf2fd; border-color: #b9d3f5; }
.carrier-seino  { color: #8a4b00; background: #fff4e5; border-color: #f3c98f; }

/* ソリッドピルの追加色（stock / docs） */
.pill-stock { color: #fff; background: #8a5300; border-color: #703f00; }
.pill-docs  { color: #fff; background: #5546b8; border-color: #44379a; }

/* 検索条件: 適用中チップの × */
.chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: 3px;
  border-radius: 50%; color: var(--text-2); text-decoration: none;
  font-weight: 700; line-height: 1;
}
.chip-x:hover { color: #fff; background: var(--danger); text-decoration: none; }
.count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px; margin-left: 3px;
  border-radius: var(--r-full); background: var(--primary); color: #fff;
  font-size: var(--fs-2xs); font-weight: 700;
}
.page-help { margin-top: 4px; }
.page-help summary {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text-3); font-size: var(--fs-xs); cursor: pointer;
}
.page-help p { max-width: 900px; margin: 6px 0 0; color: var(--text-2); font-size: var(--fs-sm); }
.link-btn {
  padding: 0; border: 0; background: none; color: var(--link);
  font: inherit; text-decoration: underline; cursor: pointer;
}

/* 詳細検索・帳票一括のモーダル */
.advanced-dialog {
  width: min(1100px, 96vw); max-height: 92vh; padding: 0;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 24px 64px rgba(16, 24, 40, 0.24);
}
.advanced-dialog::backdrop { background: rgba(16, 24, 40, 0.45); }
.advanced-dialog .dialog-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--border-soft);
}
.advanced-dialog .dialog-head h2 { margin: 0; font-size: 18px; }
.advanced-dialog .dialog-body { max-height: 72vh; overflow: auto; padding: 14px 20px 18px; }
.advanced-dialog .dialog-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--border-soft);
  background: var(--surface-subtle);
}
.advanced-section {
  margin: 16px 0 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
  font-size: var(--fs-sm); font-weight: 750; color: var(--text-2);
}
.advanced-grid { grid-template-columns: repeat(3, 1fr); }
.advanced-grid .span2 { grid-column: span 2; }
.range-row { display: flex; align-items: center; gap: 7px; }
.range-row .input { flex: 1; min-width: 0; }
.range-row > span { color: var(--text-3); flex: none; }
.error-list { margin: 5px 0 0; padding-left: 20px; }
.bulk-doc-dialog { width: min(620px, 96vw); }
.status-sort-input { width: 5.5em; }
.status-master-table { min-width: 1080px; }
.status-master-table .input-sm { min-width: 8em; }

@media (max-width: 1000px) {
  .advanced-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .advanced-dialog { width: 100vw; max-height: 100vh; border-radius: 0; }
  .advanced-dialog .dialog-body { max-height: calc(100vh - 120px); }
  .advanced-grid { grid-template-columns: 1fr; }
  .advanced-grid .span2 { grid-column: auto; }
  .range-row { flex-wrap: wrap; }
}

/* 受注一覧: 表示件数（検索条件ではなく表示設定） */
.action-bar .per-page {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap;
}
.action-bar .per-page-select { width: auto; min-width: 5.5em; }
