:root {
  color-scheme: light;
  --bg: #f7f5f0;
  --surface: #fffdf8;
  --surface-2: #f0ede5;
  --ink: #1f2423;
  --muted: #6b706c;
  --line: #ded8ca;
  --accent: #b9934c;
  --accent-dark: #72531e;
  --sage: #46675a;
  --plum: #6c4658;
  --rose: #b5655d;
  --blue: #385f78;
  --shadow: 0 18px 42px rgba(56, 45, 26, 0.08);
  --radius: 8px;
  --font: "Hiragino Sans", "Yu Gothic", "YuGothic", "Noto Sans JP", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.8), rgba(247, 245, 240, 0.95)),
    repeating-linear-gradient(90deg, rgba(31, 36, 35, 0.02) 0, rgba(31, 36, 35, 0.02) 1px, transparent 1px, transparent 28px);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(190px, 260px) 1fr auto;
  align-items: center;
  gap: 20px;
  min-height: 72px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--accent);
  background: #222725;
  color: #f4deb2;
  font-family: Georgia, serif;
  font-size: 18px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: Georgia, serif;
  font-size: 19px;
  letter-spacing: 0;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  min-height: 44px;
  min-width: 70px;
  padding: 0 14px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--ink);
  border-color: var(--accent);
}

.operator,
.head-actions,
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.operator {
  justify-content: flex-end;
}

.store-chip,
.profile-button,
.secondary-button,
.primary-button,
.icon-button,
.text-button,
.payment-options button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: var(--radius);
  white-space: nowrap;
}

.store-chip {
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
}

.icon-button,
.profile-button,
.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.icon-button {
  width: 40px;
  padding: 0;
}

.profile-button {
  padding: 0 12px 0 8px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sage);
  color: #fff;
  font-size: 12px;
}

.secondary-button,
.primary-button {
  padding: 0 14px;
  border: 1px solid var(--line);
}

.primary-button {
  background: var(--ink);
  color: #fffdf8;
  border-color: var(--ink);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  padding: 0;
  min-height: 32px;
}

.full-width {
  width: 100%;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 26px 24px 48px;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 500;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
}

h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.panel-head {
  justify-content: space-between;
  min-height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.panel-note {
  color: var(--muted);
  font-size: 13px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.kpi-card {
  padding: 18px;
  min-height: 132px;
}

.kpi-card p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.kpi-card strong {
  display: block;
  font-size: 28px;
  line-height: 1.05;
}

.kpi-card span {
  display: inline-flex;
  margin-top: 12px;
  color: var(--sage);
  font-size: 13px;
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.span-7 {
  grid-column: span 7;
}

.span-5 {
  grid-column: span 5;
}

.bar-chart {
  display: flex;
  align-items: end;
  gap: 16px;
  height: 260px;
  padding: 26px 24px 20px;
}

.bar-item {
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  gap: 8px;
  flex: 1;
  min-width: 0;
  height: 100%;
}

.bar-track {
  display: flex;
  align-items: end;
  height: 100%;
  background: #ebe6dc;
  border-radius: var(--radius);
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  min-height: 18px;
  background: linear-gradient(180deg, #d2b36f, #76612f);
}

.bar-item small,
.bar-item strong {
  display: block;
  text-align: center;
}

.bar-item small {
  color: var(--muted);
  font-size: 12px;
}

.bar-item strong {
  font-size: 12px;
}

.category-list {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.category-row {
  display: grid;
  grid-template-columns: minmax(86px, 120px) 1fr auto;
  align-items: center;
  gap: 12px;
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e1d5;
}

.meter span {
  display: block;
  height: 100%;
  background: var(--sage);
}

.category-row:nth-child(2) .meter span {
  background: var(--plum);
}

.category-row:nth-child(3) .meter span {
  background: var(--accent);
}

.category-row:nth-child(4) .meter span {
  background: var(--blue);
}

.task-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.task-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  padding: 14px 18px;
  border: 0;
  background: var(--surface);
  color: inherit;
  text-align: left;
}

.task-item:hover {
  background: #faf6ec;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #efe4c9;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.badge.sage {
  background: #deebe3;
  color: #2e594a;
}

.badge.plum {
  background: #eadde3;
  color: #6c4658;
}

.badge.rose {
  background: #f0dedb;
  color: #8b443c;
}

.task-copy strong {
  display: block;
  margin-bottom: 4px;
}

.task-copy small {
  color: var(--muted);
}

.customer-layout,
.inventory-layout,
.pos-layout {
  display: grid;
  gap: 16px;
}

.customer-layout {
  grid-template-columns: 300px 1fr;
}

.customer-list {
  padding: 16px;
  align-self: start;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.customer-list-items {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.customer-list-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  width: 100%;
  min-height: 64px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  text-align: left;
}

.customer-list-button.active,
.customer-list-button:hover {
  border-color: var(--line);
  background: #faf6ec;
}

.customer-list-button small {
  color: var(--muted);
}

.customer-main {
  display: grid;
  gap: 16px;
}

.customer-profile {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  padding: 20px;
}

.customer-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.customer-name-row h2 {
  font-size: 26px;
}

.profile-meta,
.asset-list,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.profile-meta li,
.asset-list li,
.tag-list li {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.profile-note {
  color: var(--muted);
  line-height: 1.7;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.timeline,
.order-mini-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.timeline-item,
.mini-order {
  padding: 15px 18px;
  border: 0;
  background: var(--surface);
  color: inherit;
  text-align: left;
  width: 100%;
}

.timeline-item strong,
.mini-order strong {
  display: block;
  margin-bottom: 6px;
}

.timeline-item p,
.mini-order p {
  margin-bottom: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.timeline-item small,
.mini-order small {
  color: var(--accent-dark);
  font-weight: 700;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.kanban-column {
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.78);
}

.kanban-title {
  display: flex;
  justify-content: space-between;
  min-height: 50px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}

.order-card {
  display: block;
  width: calc(100% - 20px);
  margin: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-align: left;
  box-shadow: 0 10px 22px rgba(56, 45, 26, 0.08);
}

.order-card:hover {
  border-color: var(--accent);
}

.order-card p {
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.order-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  margin: 0;
  font-size: 13px;
}

.order-card dt {
  color: var(--muted);
}

.order-card dd {
  margin: 0;
  text-align: right;
}

.inventory-tools {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.inventory-layout {
  grid-template-columns: 1fr 360px;
}

.inventory-table-wrap {
  overflow: hidden;
}

.inventory-table {
  width: 100%;
  border-collapse: collapse;
}

.inventory-table th,
.inventory-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.inventory-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.inventory-table tr {
  cursor: pointer;
}

.inventory-table tbody tr:hover,
.inventory-table tbody tr.selected {
  background: #faf6ec;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jewel-art {
  position: relative;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f4efe6;
}

.jewel-art::before,
.jewel-art::after {
  content: "";
  position: absolute;
}

.jewel-art.pearl::before {
  inset: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #e5dfd4 45%, #c9ba98);
  box-shadow: -12px 9px 0 -3px #e9e1d0, 12px -8px 0 -4px #d7c8a6;
}

.jewel-art.ring::before {
  left: 14px;
  top: 22px;
  width: 30px;
  height: 24px;
  border: 5px solid #b9934c;
  border-radius: 50%;
}

.jewel-art.ring::after {
  left: 24px;
  top: 10px;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #fff, #b4d0db);
  clip-path: polygon(50% 0, 100% 35%, 80% 100%, 20% 100%, 0 35%);
}

.jewel-art.ruby::before {
  left: 18px;
  top: 12px;
  width: 22px;
  height: 28px;
  background: radial-gradient(circle at 35% 30%, #ffb6a8, #a72e43 58%, #5f1d2d);
  clip-path: polygon(50% 0, 88% 28%, 78% 100%, 22% 100%, 12% 28%);
}

.jewel-art.ruby::after {
  left: 29px;
  top: 36px;
  width: 2px;
  height: 12px;
  background: #b9934c;
}

.jewel-art.earring::before {
  left: 15px;
  top: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #c7d4d9);
  box-shadow: 14px 14px 0 #d6dce0;
}

.jewel-art.stone::before {
  left: 10px;
  top: 18px;
  width: 38px;
  height: 22px;
  background: linear-gradient(135deg, #6aa1a5, #cfcc90 42%, #8a4866);
  clip-path: polygon(10% 30%, 28% 0, 75% 0, 95% 35%, 50% 100%);
}

.history-panel {
  align-self: start;
  padding: 18px;
}

.history-panel h2 {
  margin-bottom: 6px;
}

.history-panel .serial {
  color: var(--accent-dark);
  font-weight: 700;
}

.stock-history-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.stock-event {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.stock-event time {
  color: var(--muted);
  font-size: 13px;
}

.stock-event strong {
  display: block;
  margin-bottom: 4px;
}

.stock-event p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.pos-layout {
  grid-template-columns: 1fr 360px;
}

.pos-lines,
.checkout-panel {
  padding: 18px;
}

.large-search {
  min-height: 56px;
  margin-bottom: 16px;
}

#pos-line-list {
  display: grid;
  gap: 12px;
}

.pos-line {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.qty-control {
  display: grid;
  grid-template-columns: 36px 40px 36px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.qty-control button,
.qty-control span {
  display: grid;
  place-items: center;
  height: 36px;
  border: 0;
  background: #fff;
}

.qty-control span {
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.document-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
}

.document-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.checkout-panel h2 {
  margin-bottom: 18px;
}

.totals {
  display: grid;
  gap: 14px;
  margin: 0 0 20px;
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.totals dt {
  color: var(--muted);
}

.totals dd {
  margin: 0;
  font-weight: 700;
}

.grand-total {
  align-items: baseline;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.grand-total dd {
  color: var(--accent-dark);
  font-size: 30px;
}

.payment-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.payment-options button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.payment-options .selected {
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  transform: translateY(16px);
  opacity: 0;
  max-width: 320px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .operator {
    display: none;
  }

  .main-nav {
    overflow-x: auto;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .span-7,
  .span-5 {
    grid-column: span 12;
  }

  .customer-layout,
  .inventory-layout,
  .pos-layout {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .customer-profile {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 12px;
  }

  main {
    padding: 18px 12px 36px;
  }

  .page-head {
    display: grid;
    align-items: start;
  }

  .head-actions {
    flex-wrap: wrap;
  }

  h1 {
    font-size: 28px;
  }

  .kpi-grid,
  .inventory-tools {
    grid-template-columns: 1fr;
  }

  .bar-chart {
    gap: 8px;
    padding: 18px 12px 16px;
  }

  .category-row,
  .task-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .inventory-table th:nth-child(2),
  .inventory-table td:nth-child(2),
  .inventory-table th:nth-child(5),
  .inventory-table td:nth-child(5) {
    display: none;
  }

  .pos-line {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================
   顧客・販売管理DX 改修分（CRM／Webアプリ役割分担に対応）
   =================================================================== */

:root {
  --navy: #16223c;
  --navy-2: #22314f;
}

/* --- grouped nav (CRM / Webアプリ) --- */
.main-nav {
  flex-wrap: wrap;
  gap: 10px;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px 4px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.nav-group .grp {
  margin-right: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.grp.crm {
  background: var(--navy);
}

.grp.web {
  background: var(--accent);
}

a.nav-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* --- system chips --- */
.sys-chip,
.src-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.sys-chip {
  padding: 2px 10px;
  margin-right: 8px;
  font-size: 11px;
}

.src-chip {
  padding: 1px 8px;
  margin-left: 8px;
  font-size: 10px;
}

.sys-chip.crm,
.src-chip.crm {
  background: var(--navy);
}

.sys-chip.web,
.src-chip.web {
  background: var(--accent);
}

/* --- 納品・売上（CRM） --- */
.order-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f6f8fb;
}

.order-pick strong {
  display: block;
}

.order-pick small {
  color: var(--muted);
}

.pos-line > strong {
  font-size: 18px;
}

.payment-options.five {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-options.five button {
  flex: 1 1 30%;
}

.sync-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.primary-button:disabled {
  opacity: 0.55;
  cursor: default;
}

/* --- 発注・入庫（Webアプリ） --- */
.procure-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
}

.po-table td {
  font-size: 14px;
}

.chip-btn {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.chip-btn:hover {
  background: var(--accent-dark);
}

.new-po-panel {
  align-self: start;
}

.new-po-body {
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px;
}

.fld {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.fld > span:first-child {
  color: var(--muted);
  font-weight: 700;
}

.fld input[type="text"],
.fld input:not([type]) {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mini-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.mini-lines th {
  padding: 8px 10px;
  background: var(--navy-2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.mini-lines td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.po-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --- 組立カンバン（Webアプリ） --- */
.board-hint {
  margin: -6px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(205px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.kanban-board .kanban-column {
  min-width: 205px;
}

.done-col .kanban-title {
  background: #eef4ef;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.ktag {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}

.ktag.out {
  border-color: #d2b277;
  background: #faf4e9;
  color: #9a7b33;
}

.ktag.in {
  border-color: #9cc1ad;
  background: #eef6f1;
  color: #2e594a;
}

/* --- 在庫（2層セグメント・来歴） --- */
.inventory-tools {
  grid-template-columns: auto 1fr 180px;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.seg-btn {
  min-height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.seg-btn.active {
  background: var(--accent);
  color: #fff;
}

.inventory-layout.single {
  grid-template-columns: 1fr;
}

[hidden] {
  display: none !important;
}

.history-panel > .jewel-art {
  display: block;
  margin-bottom: 10px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--accent-dark);
}

.barcode {
  margin: 2px 0 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--ink);
}

/* --- 製造状況ウィジェット（顧客カルテ内） --- */
.stage-dots {
  display: inline-flex;
  gap: 5px;
  margin: 4px 0 8px;
}

.stage-dots i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #e4ddcf;
}

.stage-dots i.on {
  background: var(--accent);
}

/* --- BOM モーダル --- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(22, 27, 26, 0.5);
}

.modal.show {
  display: flex;
}

.modal-box {
  width: 100%;
  max-width: 540px;
  max-height: 84vh;
  overflow: auto;
  padding: 24px 26px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-box h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.modal-sub {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}

.bom-total {
  margin: 12px 0 18px;
  text-align: right;
  font-size: 17px;
  font-weight: 700;
  color: var(--accent-dark);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

/* --- responsive --- */
@media (max-width: 1100px) {
  .procure-layout {
    grid-template-columns: 1fr;
  }

  .inventory-tools {
    grid-template-columns: 1fr;
  }
}
