:root {
  --surface: #ffffff;
  --surface-subtle: #f3f6f9;
  --primary: #2d5da1;
  --primary-subtle: #e5ecf6;
  --primary-hover: #234a82;
  --text: #0f0f0f;
  --text-subtle: #606060;
  --border: #dadce0;
  --border-strong: #c0c0c0;
  --danger: #c5221f;
  --danger-subtle: #fce8e6;
  --success: #188038;
  --success-subtle: #e6f4ea;
  --warning: #c25e00;
  --warning-subtle: #fff3e0;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --duration: 140ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 360px;
  min-height: 100vh;
  font-size: 14px;
  color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", system-ui, sans-serif;
  background: #f3f6f9;
}

body.wordmark-body {
  min-width: 0;
  display: grid;
  place-items: center;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

a,
button,
input,
textarea,
select,
.button,
.card,
.panel,
.table-card,
.metric {
  transition:
    background-color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease),
    color var(--duration) var(--ease),
    transform var(--duration) var(--ease),
    opacity var(--duration) var(--ease);
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 72px;
}

.login-main {
  max-width: 560px;
}

.login-main .hero,
.login-main .layout {
  max-width: 100%;
}

.wordmark-main {
  min-height: 100vh;
  width: 100%;
  max-width: none;
  display: grid;
  place-items: center;
  padding: 32px;
}

.wordmark-title {
  margin: 0;
  font-size: clamp(32px, 7vw, 72px);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--primary);
}

body.admin-body {
  min-width: 0;
  overflow: hidden;
}

.admin-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 28px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.admin-env-badge {
  flex: 0 0 auto;
  align-self: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.2;
  color: #fff;
  background: #ea580c;
}

.admin-topbar-title-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  flex: 0 0 auto;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  clip-path: circle(50% at 50% 50%);
  appearance: none;
  -webkit-appearance: none;
  background-clip: padding-box;
  box-shadow: none;
  cursor: pointer;
}

.admin-sidebar-toggle svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.admin-sidebar-toggle:hover {
  background: var(--primary-subtle);
  border-color: var(--primary);
}

.admin-sidebar-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.admin-topbar-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.admin-topbar-intake {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-topbar-intake__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
}

.admin-topbar-intake__select {
  min-width: min(220px, 100%);
  max-width: min(360px, 100%);
  padding: 6px 36px 6px 12px;
  border: 1px solid var(--border, #dbe4ef);
  border-radius: 999px;
  background-color: var(--surface, #fff);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23606060' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1.5 2 6 6.5 10.5 2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.admin-topbar-intake__value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #0f172a);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-topbar-intake__empty {
  font-size: 13px;
}

.admin-topbar-subtle {
  margin-top: 0;
  color: var(--text-subtle);
  font-size: 13px;
}

/* ---- User avatar menu ---- */
.user-menu {
  position: relative;
}

.user-avatar-stack {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.12s;
}

.user-avatar:hover {
  opacity: 0.85;
}

.user-avatar--large {
  width: 48px;
  height: 48px;
  font-size: 18px;
  cursor: default;
  flex-shrink: 0;
}

.user-avatar--large:hover {
  transform: none;
  box-shadow: none;
}

.user-avatar-impersonation-badge {
  position: absolute;
  right: -4px;
  bottom: -3px;
  z-index: 2;
  pointer-events: none;
  padding: 2px 4px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-subtle);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.06em;
}

.user-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 100;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.user-popover-section {
  padding: 16px;
}

.user-popover-section + .user-popover-section {
  border-top: 1px solid var(--border);
}

.user-popover-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-popover-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}

.user-popover-name {
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

.user-popover-sub {
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: 1px;
}

.user-popover-actions {
  padding: 12px 16px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.admin-sidebar {
  background: var(--surface);
  border-right: none;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.admin-sidebar-overlay {
  display: none;
}

.admin-nav {
  padding: 12px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nav-divider {
  height: 1px;
  background: #e5e5e5;
  margin: 12px 16px;
}

.nav-section {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nav-section-label {
  display: block;
  margin: 0;
  padding: 8px 12px 4px 16px;
  color: #606060;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.nav-section-label::before,
.nav-section-label::after {
  content: none;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  gap: 10px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  min-width: 0;
  transition: background 0.15s;
}

.nav-link-main {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1 1 auto;
  min-width: 0;
}

.nav-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  color: #606060;
}

.nav-link-icon svg {
  width: 24px;
  height: 24px;
}

.nav-link-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-link-meta {
  flex: 0 0 auto;
  margin-left: auto;
  text-align: right;
  font-size: 12px;
  font-weight: 400;
  color: #606060;
  line-height: 1;
}

/* 依頼・回答一覧の状態バッジ（.support-ticket-status-pill）と同色 */
.nav-link-badge {
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f64c3b;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.nav-link-badge--open {
  background: #f64c3b;
  color: #fff;
}

.nav-link-badge--in-progress {
  background: #ffb43d;
  color: #fff;
}

.nav-link-badge-stack {
  flex: 0 0 auto;
  margin-left: auto;
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-end;
  overflow: visible;
  padding-left: 3px;
  padding-bottom: 3px;
  min-height: 22px;
}

/* 前面の赤丸と同一直径（22×22）のオレンジ丸を、左下へ 3px だけずらして重ねる */
.nav-link-badge--stacked-behind {
  position: absolute;
  z-index: 0;
  right: 0;
  top: 0;
  width: 22px;
  min-width: 22px;
  max-width: 22px;
  height: 22px;
  padding: 0;
  margin-left: 0;
  box-sizing: border-box;
  border-radius: 999px;
  background: #ffb43d;
  box-shadow: none;
  transform: translate(-3px, 3px);
}

.nav-link-badge--stacked-front {
  position: relative;
  z-index: 1;
  margin-left: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.nav-link:hover {
  background: #f2f2f2;
  color: var(--text);
}

.nav-link[aria-current="page"] {
  background: var(--primary-subtle);
  font-weight: 600;
  color: var(--primary);
}

.nav-link[aria-current="page"] .nav-link-icon {
  color: var(--primary);
}

.nav-link[aria-current="page"] .nav-link-icon svg {
  stroke-width: 2.2;
}

.nav-link[aria-current="page"] .nav-link-meta {
  font-weight: 600;
  color: var(--primary);
}

.nav-link[aria-current="page"] .nav-link-badge--open {
  background: #f64c3b;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.nav-link[aria-current="page"] .nav-link-badge--in-progress:not(.nav-link-badge--stacked-behind) {
  background: #ffb43d;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.nav-link[aria-current="page"] .nav-link-badge--stacked-behind {
  background: #ffb43d;
  box-shadow: none;
}

.nav-link[aria-current="page"] .nav-link-badge--stacked-front {
  background: #f64c3b;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.admin-content {
  min-width: 0;
  min-height: 0;
  max-width: none;
  width: 100%;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  padding: 28px 32px;
  background: var(--surface-subtle);
}

.admin-content .hero,
.admin-content .layout {
  max-width: none;
}

/* 荷受一覧: Excel と同様に、画面内の残り領域を表のスクロール領域として使う */
.admin-content--receivings-grid {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-content--receivings-grid > .layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.admin-content--receivings-grid > .layout > .admin-collapsible,
.admin-content--receivings-grid > .layout > .admin-receiving-summary-bar {
  flex: 0 0 auto;
}

.admin-content--receivings-grid .admin-collapsible[open] .admin-collapsible-body {
  box-sizing: border-box;
  max-height: clamp(120px, calc(100dvh - 550px), 450px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.admin-receivings-table-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-scroll.admin-receivings-data-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.admin-receivings-infinite-sentinel {
  box-sizing: border-box;
  min-width: 100%;
  padding: 12px 0 2px;
}

/* 荷受一覧では通常列の省略をやめる。備考だけは短い固定幅で省略表示する。 */
.admin-receivings-data-grid .admin-cell-ellipsis {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

.admin-receivings-data-grid .admin-cell-ellipsis.admin-cell-w-notes {
  width: 144px;
  max-width: 144px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-page-toolbar {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  flex-wrap: wrap;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text-subtle);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.hero h1 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* 管理一覧: 行の名称セル左にナビと同系の SVG（サイドバーより一回り小さく） */
.admin-list-name-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.admin-list-name-with-icon .admin-list-item-icon.nav-link-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  align-self: flex-start;
  margin-top: 1px;
  color: #606060;
}

.admin-list-name-with-icon .admin-list-item-icon svg {
  width: 18px;
  height: 18px;
}

.admin-list-name-with-icon .admin-list-name-text {
  min-width: 0;
  flex: 1 1 auto;
}

.lead {
  max-width: none;
  margin: 4px 0 0;
  color: var(--text-subtle);
  font-size: 13px;
  line-height: 1.6;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}

.service-ja-row-actions {
  gap: 12px;
  align-items: center;
  padding: 2px 0;
}

.service-backup-row-actions {
  gap: 8px;
  align-items: center;
}

.service-backup-row-actions form {
  margin: 0;
}

.modal-action-footer > form {
  margin: 0;
}

.backup-copy-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.backup-copy-button--icon-only {
  padding: 10px;
  min-width: 0;
}

.action-row {
  display: flex;
  width: 100%;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.machine-csv-import-form {
  padding: 10px 14px;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.machine-csv-import-form--overflow {
  padding: 0;
  margin: 0;
  border: 0;
}

.machine-csv-overflow {
  position: relative;
  display: inline-flex;
  align-items: center;
}



.machine-csv-overflow-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: min(320px, calc(100vw - 32px));
  padding: 12px 14px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.machine-csv-overflow-panel[hidden] {
  display: none !important;
}

.machine-csv-overflow-heading {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.machine-csv-overflow-resource {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.machine-csv-overflow-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.machine-csv-overflow-actions .button,
.machine-csv-overflow-actions button,
.machine-csv-overflow-export {
  width: 100%;
  min-height: 40px;
  border-radius: 999px;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 9px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(45, 93, 161, 0.3);
}

.button:hover,
button:hover {
  background: var(--primary-hover);
  box-shadow: 0 2px 6px rgba(45, 93, 161, 0.35);
}

.button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
  box-shadow: none;
}

.button:disabled:hover,
button:disabled:hover {
  background: var(--primary);
  box-shadow: none;
}

.backup-job-button {
  min-width: 240px;
}

.backup-job-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: backup-spin 0.8s linear infinite;
}

@keyframes backup-spin {
  to {
    transform: rotate(360deg);
  }
}

.button-secondary {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border);
  border-radius: 999px;
  box-shadow: none;
  font-weight: 500;
}

.button-secondary:hover {
  background: var(--primary-subtle);
  border-color: var(--primary);
  box-shadow: none;
}

.machine-csv-overflow-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  padding: 0;
  border-radius: 50% !important;
  border: none;
  flex: 0 0 40px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  clip-path: circle(50% at 50% 50%);
  appearance: none;
  -webkit-appearance: none;
  background-clip: padding-box;
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
  box-shadow: none;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
}

.machine-csv-overflow-toggle:hover,
.machine-csv-overflow-toggle:focus-visible {
  background: var(--primary-subtle);
  border-color: var(--primary);
  box-shadow: none;
}

button.user-avatar,
.user-avatar {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  flex: 0 0 34px;
}

.user-avatar.user-avatar--large,
button.user-avatar.user-avatar--large {
  width: 48px;
  height: 48px;
  min-height: 48px;
  flex-basis: 48px;
}

.button-warm {
  background: var(--danger);
  box-shadow: none;
}

.button-warm:hover {
  background: #a50e0e;
}

.layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.card-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  align-items: start;
}

.card,
.panel,
.table-card,
.metric {
  background: var(--surface);
  border: none;
  box-shadow: var(--shadow-sm);
}

.card,
.panel,
.table-card {
  min-width: 0;
  padding: 22px;
  border-radius: 16px;
}

.metric {
  padding: 22px;
  border-radius: 16px;
}

.metric-value {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
}

.metric-label,
.subtle {
  color: var(--text-subtle);
}

.card h2,
.panel h2,
.table-card h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.card p,
.panel p {
  margin: 0;
  color: var(--text-subtle);
  line-height: 1.65;
  font-size: 13px;
}

.stack {
  display: grid;
  gap: 14px;
}

.list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-subtle);
}

.list li + li {
  margin-top: 6px;
}

.table,
.panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table-scroll {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  /* Y は clip（スクロールコンテナにしない）。横スクロールのみのラッパーでも一部引擎は computed を hidden と報告する。 */
  overflow-y: clip;
}

/* 一覧テーブルはプロジェクト全体で単一行表示に揃え、必要なら横スクロールさせる */
.table-scroll > table {
  width: 100%;
  min-width: max-content;
  max-width: none;
}

.table-scroll > table th,
.table-scroll > table td {
  white-space: nowrap;
}

.admin-table[data-admin-sticky-table-header] thead th,
.table.farmer-table[data-admin-sticky-table-header] thead th,
.table.support-ticket-table[data-admin-sticky-table-header] thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface);
  box-shadow: 0 1px 0 #eeeeee;
}

/* 無限スクロール付き一覧: sticky が効かない引擎向けに admin-table-sort.js が挿入するミラー用 */
.admin-infinite-sticky-mirror {
  display: none;
  position: fixed;
  z-index: 25;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

/* 横スクロールは本体 .table-scroll の 1 本だけ見せる（Mac/Windows 共通で二重バーを避ける） */
.admin-infinite-sticky-mirror-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.admin-infinite-sticky-mirror-scroll::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.admin-infinite-sticky-mirror-table {
  margin: 0;
  border-collapse: collapse;
}

.admin-infinite-sticky-mirror-table tbody {
  display: none;
}

.table th,
.table td,
.panel table th,
.panel table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #eeeeee;
}

.table th,
.panel table th {
  color: var(--text-subtle);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.table tbody tr:hover td,
.panel table tbody tr:hover td {
  background: #fafbfc;
}

/* データ行のみ最終行の下罫線を外す（th+td の定義リスト型は最終行も左右そろえて罫線を残す） */
.table tr:last-child:not(:has(th)) td,
.panel table tr:last-child:not(:has(th)) td {
  border-bottom: none;
}

.table th.table-align-right,
.table td.table-align-right,
.panel table th.table-align-right,
.panel table td.table-align-right {
  text-align: right;
}

/* 数値列: block + max-width のellipsisがセル左に残るのを防ぎ、右端に寄せる */
.table td.table-align-right > .admin-cell-ellipsis.admin-cell-num,
.panel table td.table-align-right > .admin-cell-ellipsis.admin-cell-num {
  margin-left: auto;
}

.farmer-table tbody tr {
  transition:
    background-color 120ms ease,
    color 120ms ease;
}

.farmer-table tbody tr.farmer-row-selected td {
  background: var(--primary);
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

/* 選択中もホバー中も背景をプライマリのまま維持（汎用 .table tbody tr:hover や .admin-row-link:hover より優先） */
.farmer-table tbody tr.farmer-row-selected:hover td {
  background: var(--primary);
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.farmer-table tbody tr.farmer-row-selected a {
  color: #fff;
}

.farmer-table tbody tr.farmer-row-selected .button.button-secondary {
  border-color: rgba(255, 255, 255, 0.78);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.farmer-table tbody tr.farmer-row-selected .button.button-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
}

.mono {
  font-family: "SFMono-Regular", "SF Mono", Consolas, monospace;
}

.csv-preview-value-stack {
  display: inline-grid;
  gap: 7px;
  align-items: start;
}

.csv-preview-value {
  display: inline-block;
  max-width: min(42ch, 100%);
  overflow-wrap: anywhere;
}

.csv-preview-old {
  color: var(--text-subtle);
  text-decoration: line-through;
}

.csv-preview-new {
  padding: 4px 10px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--primary-subtle) 88%, #fff 12%);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 24%, transparent);
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.filter-btn {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-subtle);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  /* 共通の button スタイルの box-shadow と min-height を打ち消す（フラットなピル） */
  box-shadow: none;
  min-height: 0;
  line-height: 1.25;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-subtle);
  box-shadow: none;
}

.filter-btn--active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: none;
}

.filter-btn--active:hover {
  background: var(--primary-hover);
  color: #fff;
  border-color: var(--primary-hover);
  box-shadow: none;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.role-badge--admin {
  background: var(--primary-subtle);
  color: var(--primary);
}

.role-badge--staff {
  background: var(--success-subtle);
  color: var(--success);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-waiting {
  background: var(--warning-subtle);
  color: var(--warning);
}

.status-loaded {
  background: #e8f0fe;
  color: #1a73e8;
}

.status-transferring {
  background: #f3e8fd;
  color: #7b1fa2;
}

.status-transfer-waiting {
  background: #e6f4ea;
  color: #188038;
}

.status-inspected {
  background: #fde7f3;
  color: #ad1457;
}

.status-open {
  background: var(--danger-subtle);
  color: var(--danger);
}

.status-in-progress {
  background: var(--warning-subtle);
  color: var(--warning);
}

.status-resolved {
  background: var(--success-subtle);
  color: var(--success);
}

.status-radio-label {
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition:
    background-color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    color var(--duration) var(--ease);
}

.status-radio-label:hover {
  border-color: var(--border-strong);
}

.status-radio-label input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 依頼・回答の状態ラジオの色・枠は support-tickets-page の SUPPORT_TICKET_LIST_STYLES 側で .support-ticket-status-pill と併用して指定 */

.status-radio-label:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.notice,
.error {
  padding: 14px 16px;
  border-radius: 12px;
  font-weight: 600;
}

.notice {
  background: var(--success-subtle);
  color: var(--success);
}

.error {
  background: var(--danger-subtle);
  color: var(--danger);
}

.admin-toast {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top, 0px));
  right: 20px;
  z-index: 140;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms ease;
}

.admin-toast-notice {
  color: var(--primary);
  background: #fff;
  border: 1px solid rgba(45, 93, 175, 0.24);
}

.admin-toast-error {
  color: var(--danger);
  background: #fff;
  border: 1px solid rgba(197, 34, 31, 0.2);
}

.admin-toast-hidden {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

form {
  display: grid;
  gap: 14px;
}

.admin-filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.admin-filter-grid > * {
  min-width: 0;
}

.admin-filter-grid input,
.admin-filter-grid select {
  width: 100%;
  min-width: 0;
}

.admin-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* 組合員一覧: 検索対象プルダウン → キーワード → 検索（荷受一覧のグリッドとは独立） */
.farmer-list-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}

.farmer-list-filter-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.farmer-list-filter-field--scope {
  flex: 0 1 auto;
  width: min(100%, 280px);
}

.farmer-list-filter-field--keyword {
  flex: 1 1 220px;
  min-width: min(100%, 200px);
}

.farmer-list-filter-field--duplicate {
  flex: 0 0 auto;
}

.farmer-list-filter-field--actions {
  flex: 0 0 auto;
}

.farmer-list-filter-field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-subtle);
}

.farmer-list-filter-field-label--visually-empty {
  visibility: hidden;
  min-height: 1.2em;
}

.farmer-list-filter-field--scope select,
.farmer-list-filter-field--keyword input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
}

.farmer-list-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #d8e0ec;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.farmer-list-filter-check input {
  width: 16px;
  height: 16px;
  margin: 0;
}

/* ネイティブ select をピル型に合わせて平坦化しカスタム矢印を表示（app.css 利用画面共通） */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23606060' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1.5 2 6 6.5 10.5 2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.farmer-list-filter-actions-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.receiving-filter-form {
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 16px;
}

.receiving-filter-fields-panel,
.receiving-filter-actions-panel {
  border: 1px solid rgba(213, 222, 236, 0.92);
  border-radius: 24px;
}

.receiving-filter-fields-panel {
  padding: 18px;
  background: #f8fbff;
}

.receiving-filter-actions-panel {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 18px;
  background: #f3f7fd;
}

.receiving-filter-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.receiving-filter-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.receiving-filter-field--keyword {
  grid-column: 1 / span 2;
}

.receiving-filter-field input,
.receiving-filter-field select {
  width: 100%;
  min-width: 0;
}

.receiving-filter-range {
  display: grid;
  grid-column: 1 / span 2;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.receiving-filter-actions {
  width: 100%;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.receiving-filter-actions .button,
.receiving-filter-actions button {
  width: 100%;
  min-width: 0;
  justify-content: center;
}

@media (min-width: 1680px) {
  .receiving-filter-form {
    grid-template-columns: minmax(0, 1fr) 280px;
  }

  .receiving-filter-fields {
    grid-template-columns: minmax(240px, 1.6fr) repeat(4, minmax(140px, 1fr));
  }

  .receiving-filter-field--keyword {
    grid-column: 1 / 2;
  }

  .receiving-filter-range {
    grid-column: 1 / span 3;
  }
}

.admin-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-section-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.admin-section-head-count {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
}

.admin-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.admin-filter-export-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  margin-bottom: 12px;
}

.admin-receiving-summary-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  margin-bottom: 12px;
  padding: 16px 20px;
}

.admin-receiving-summary-bar__primary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-right: 18px;
  border-right: 1px solid #d9e3f2;
  white-space: nowrap;
}

.admin-receiving-summary-bar__primary-label {
  color: var(--text-subtle);
  font-size: 14px;
  font-weight: 700;
}

.admin-receiving-summary-bar__primary-value {
  color: var(--primary);
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 34px;
  line-height: 1;
}

.admin-receiving-summary-bar__primary-unit {
  color: var(--text-subtle);
  font-size: 0.48em;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.admin-receiving-summary-bar__stats {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  flex: 1;
}

.admin-receiving-summary-bar__stat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  white-space: nowrap;
}

.admin-receiving-summary-bar__stat-label {
  color: var(--text-subtle);
  font-size: 13px;
  font-weight: 700;
}

.admin-receiving-summary-bar__stat-value {
  font-size: 16px;
}

.admin-receiving-summary-bar__export {
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.admin-collapsible {
  padding: 0;
  overflow: hidden;
}

.admin-collapsible-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
}

.admin-collapsible-summary::-webkit-details-marker {
  display: none;
}

.admin-collapsible-summary h2 {
  margin: 0;
}

.admin-collapsible-icon {
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--text-subtle);
  border-bottom: 2px solid var(--text-subtle);
  transform: rotate(45deg);
  transition: transform 140ms var(--ease);
}

.admin-collapsible[open] .admin-collapsible-icon {
  transform: rotate(225deg);
}

.admin-collapsible-body {
  padding: 0 20px 20px;
}

@media (max-width: 1120px) {
  .admin-receiving-summary-bar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .admin-receiving-summary-bar__primary {
    border-right: none;
    padding-right: 0;
  }

  .admin-receiving-summary-bar__stats {
    width: 100%;
  }

  .admin-receiving-summary-bar__export {
    margin-left: auto;
  }

  .receiving-filter-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .receiving-filter-field--keyword,
  .receiving-filter-range {
    grid-column: 1 / -1;
  }

  .receiving-filter-actions {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .receiving-filter-actions .button,
  .receiving-filter-actions button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .admin-receiving-summary-bar {
    gap: 12px;
    padding: 14px 16px;
  }

  .admin-receiving-summary-bar__primary {
    width: 100%;
  }

  .admin-receiving-summary-bar__primary-value {
    font-size: 28px;
  }

  .admin-receiving-summary-bar__stats {
    gap: 8px;
  }

  .admin-receiving-summary-bar__stat {
    padding: 7px 10px;
  }

  .admin-receiving-summary-bar__export {
    width: 100%;
    justify-content: flex-end;
  }

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

  .receiving-filter-range {
    grid-template-columns: 1fr;
  }

  .receiving-filter-actions {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .receiving-filter-actions .button,
  .receiving-filter-actions button {
    width: 100%;
    min-width: 0;
  }

  .receiving-filter-actions-panel,
  .receiving-filter-fields-panel {
    padding: 16px;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- dashboard receiving stats (receivedAt) --- */

.dashboard-stats-panel {
  margin-bottom: 16px;
}

.dashboard-stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0 0 14px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.dashboard-stats-kpi {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: flex-start;
  gap: 4px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.dashboard-stats-kpi__label {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 11px;
  line-height: 1.2;
  color: var(--text-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-stats-kpi__value {
  flex: 0 0 auto;
  font-size: clamp(17px, 2.35vw, 23px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.dashboard-stats-kpi__unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-subtle);
  margin-left: 1px;
}

.dashboard-stats-kpi__value .subtle {
  font-size: clamp(15px, 2vw, 21px);
  font-weight: 600;
}

.dashboard-stats-charts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  justify-items: stretch;
}

@media (max-width: 1024px) {
  .dashboard-stats-charts {
    grid-template-columns: 1fr;
  }
}

.dashboard-stats-chart-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.dashboard-stats-chart-block {
  min-width: 0;
  width: 100%;
}

.dashboard-stats-hourly {
  display: flex;
  align-items: flex-end;
  justify-content: stretch;
  /* 本数が多いときも列を細く均等分割する（隙間は抑える） */
  gap: clamp(1px, 0.35vw, 4px);
  width: 100%;
  min-width: 0;
  min-height: 112px;
  padding: 4px 0 0;
  overflow-x: hidden;
}

.dashboard-stats-hourly__col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}

.dashboard-stats-hourly__bar-wrap {
  width: 100%;
  height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
}

.dashboard-stats-hourly__bar {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  background: var(--primary);
  border-radius: 1px 1px 0 0;
}

.dashboard-stats-hourly__h {
  font-size: clamp(8px, 1vw, 10px);
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
  width: 100%;
  max-width: 100%;
  /* ellipsis は使わない（「時」が … に見えるのを防ぐ）。はみ出しは clip */
  overflow: hidden;
  text-overflow: clip;
}

.dashboard-stats-lead {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dashboard-stats-lead__row {
  display: grid;
  grid-template-columns: 52px 1fr 36px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.dashboard-stats-lead__label {
  color: var(--text-subtle);
  text-align: right;
}

.dashboard-stats-lead__track {
  height: 20px;
  background: var(--surface-subtle);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.dashboard-stats-lead__fill {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  min-width: 0;
}

.dashboard-stats-lead__count {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.dashboard-stats-donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.dashboard-stats-donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  box-shadow: inset 0 0 0 1px var(--border);
}

.dashboard-stats-donut::after {
  content: "";
  position: absolute;
  inset: 26px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--border);
}

.dashboard-stats-donut__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
  min-width: 0;
}

.dashboard-stats-donut__legend li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
  line-height: 1.4;
}

.dashboard-stats-donut__swatch {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-top: 3px;
}

/* --- flow graph (server-rendered SVG) --- */

.fg-panel-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fg-panel-body--flow-diagram-only {
  gap: 0;
}

.dashboard-flow-aux {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 240px);
  gap: 16px 20px;
  align-items: start;
  margin-top: 4px;
}

.dashboard-flow-aux__main {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.dashboard-flow-aux__history-group .dashboard-flow-aux__graph-label {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.dashboard-flow-aux__calendar {
  min-width: 0;
}

@media (max-width: 720px) {
  .dashboard-flow-aux {
    grid-template-columns: 1fr;
  }
}

.dashboard-flow-cal {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.dashboard-flow-aux .dashboard-flow-cal {
  margin-bottom: 0;
}

.dashboard-flow-cal--compact {
  gap: 8px;
  padding: 0;
}

.dashboard-flow-cal--compact .dashboard-flow-cal__title {
  font-size: 0.8rem;
}

.dashboard-flow-cal--compact .dashboard-flow-cal__nav.button {
  width: 1.5rem;
  height: 1.5rem;
  min-width: 1.5rem;
  padding: 0;
  font-size: 0.75rem;
}

.dashboard-flow-cal--compact .dashboard-flow-cal__grid {
  font-size: 11px;
}

.dashboard-flow-cal--compact .dashboard-flow-cal__grid th {
  padding: 2px 1px;
}

.dashboard-flow-cal--compact .dashboard-flow-cal__cell {
  padding: 2px 1px;
}

.dashboard-flow-cal--compact .dashboard-flow-cal__day {
  gap: 2px;
  min-height: 40px;
  padding: 4px 2px;
  border-radius: 8px;
}

.dashboard-flow-cal--compact .dashboard-flow-cal__dom {
  font-size: 10px;
}

.dashboard-flow-cal--compact .dashboard-flow-cal__badge {
  font-size: 10px;
  width: 1.5rem;
  height: 1.5rem;
  min-width: 1.5rem;
  padding: 0;
}

.dashboard-flow-cal--compact .dashboard-flow-cal__badge-slot {
  min-height: calc(1.5rem + 3px);
}

.dashboard-flow-cal--compact .dashboard-flow-cal__hint {
  font-size: 12px;
}

.dashboard-flow-cal__head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.dashboard-flow-cal__title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
}

.dashboard-flow-cal__nav.button {
  width: 1.75rem;
  height: 1.75rem;
  min-width: 1.75rem;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
  box-sizing: border-box;
  font-size: 0.8rem;
  border-color: transparent;
  background: transparent;
  color: var(--text-muted, #6b7280);
}

.dashboard-flow-cal__nav.button:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: transparent;
  color: var(--text, #1e293b);
}

.dashboard-flow-cal__grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.dashboard-flow-cal__grid th {
  padding: 4px 2px;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  text-align: center;
}

.dashboard-flow-cal__cell {
  padding: 4px 2px;
  vertical-align: middle;
}

.dashboard-flow-cal__pad {
  padding: 4px 2px;
}

.dashboard-flow-cal__day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-height: 52px;
  padding: 6px 4px 8px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  background: transparent;
}

.dashboard-flow-cal__day:hover {
  border-color: #c7d7eb;
  background: rgba(243, 247, 255, 0.6);
}

.dashboard-flow-cal__day.is-today {
  background: rgba(37, 99, 235, 0.08);
}

.dashboard-flow-cal__day.is-today:hover {
  background: rgba(37, 99, 235, 0.14);
}

.dashboard-flow-cal__day.is-selected {
  border: 2px solid var(--primary, #2563eb);
}

.dashboard-flow-cal__day.is-today.is-selected {
  background: rgba(37, 99, 235, 0.12);
}

.dashboard-flow-cal__dom {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-muted, #6b7280);
}

.dashboard-flow-cal__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  min-width: 1.85rem;
  margin-top: 3px;
  padding: 0;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  color: #fff;
  background: var(--primary, #2563eb);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  margin-top: 3px;
}

.dashboard-flow-cal__badge-slot {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: calc(1.85rem + 3px);
}

.dashboard-flow-cal__hint {
  margin: 0;
}

.dashboard-flow-cal__clear {
  white-space: nowrap;
}

.dashboard-flow-range {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 16px;
}

.dashboard-flow-range__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  width: 100%;
}

.dashboard-flow-range__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dashboard-flow-range__period {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0;
  padding: 0;
  border: none;
}

.dashboard-flow-range__input-date {
  min-width: 0;
  max-width: 11.5rem;
  min-height: 38px;
  height: 38px;
  padding: 0 12px;
  font-size: 13px;
  line-height: 1.25;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: none;
}

.dashboard-flow-range__input-date:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.dashboard-flow-range__period-sep {
  font-size: 13px;
  line-height: 38px;
  color: var(--text-muted, #9ca3af);
  flex: 0 0 auto;
}

.dashboard-flow-range__period .button.button-secondary {
  min-height: 38px;
  height: 38px;
  padding: 0 14px;
  box-sizing: border-box;
}

.dashboard-flow-range__btn.button.button-secondary {
  font-size: 13px;
  min-height: 38px;
  height: 38px;
  padding: 0 12px;
  box-sizing: border-box;
  text-decoration: none;
  line-height: 1.25;
}

.dashboard-flow-range__btn.button.button-secondary.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.dashboard-flow-range__btn.button.button-secondary.is-active:hover {
  filter: brightness(0.96);
  border-color: var(--primary);
}

.dashboard-flow-stack {
  display: grid;
  gap: 20px;
}

.dashboard-flow-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 10px;
}

.dashboard-flow-panel__head [data-dashboard-flow-title] {
  user-select: none;
}

.dashboard-flow-visual {
  display: grid;
  gap: 0;
}

.dashboard-flow-visual__diagram {
  min-width: 0;
}

.dashboard-flow-visual__diagram--3d {
  position: relative;
  border: 1px solid #dbe4ef;
  border-radius: 24px;
  overflow: hidden;
  background: #f8fbff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.dashboard-flow-3d-stage {
  position: relative;
  min-height: clamp(320px, 42vw, 520px);
}

.dashboard-flow-3d-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.dashboard-flow-3d-fallback {
  position: relative;
  min-height: inherit;
  height: 100%;
  overflow: hidden;
}

.dashboard-flow-3d-fallback__space,
.dashboard-flow-3d-fallback__edges {
  position: absolute;
  inset: 0;
}

.dashboard-flow-3d-fallback__space {
  perspective: 1400px;
  transform-style: preserve-3d;
}

.dashboard-flow-3d-fallback__edges {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.dashboard-flow-3d-fallback__node {
  position: absolute;
  width: 220px;
  min-height: 108px;
  padding: 18px 20px 20px;
  border: 1px solid rgba(207, 219, 232, 0.95);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 36px rgba(48, 78, 120, 0.16);
  transform:
    translate3d(-50%, -50%, calc(var(--depth, 0) * 48px))
    rotateX(14deg)
    rotateY(-18deg);
  transform-style: preserve-3d;
  animation: dashboard-flow-fallback-float 5.6s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.dashboard-flow-3d-fallback__node h3 {
  margin: 0 0 14px;
  font-size: 24px;
  line-height: 1.2;
}

.dashboard-flow-3d-fallback__status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 14px;
}

.dashboard-flow-3d-fallback__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.dashboard-flow-3d-fallback__label {
  color: #64748b;
}

.dashboard-flow-3d-fallback__count {
  font-size: 14px;
}

.dashboard-flow-3d-fallback__badge {
  position: absolute;
  right: 16px;
  bottom: 14px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #2d5da1;
  color: #fff;
  font-weight: 700;
}

.dashboard-flow-3d-empty {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px rgba(22, 33, 56, 0.12);
}

@keyframes dashboard-flow-fallback-float {
  0%, 100% {
    transform:
      translate3d(-50%, -50%, calc(var(--depth, 0) * 48px))
      rotateX(14deg)
      rotateY(-18deg)
      translateY(0);
  }
  50% {
    transform:
      translate3d(-50%, -50%, calc(var(--depth, 0) * 48px))
      rotateX(14deg)
      rotateY(-18deg)
      translateY(-8px);
  }
}

.dashboard-flow-panel__head {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.dashboard-flow-panel__head h2 {
  margin-bottom: 0;
  flex: 1 1 auto;
}

.dashboard-flow-panel__date-range {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 500;
  color: #9ca3af;
  line-height: 1.3;
  white-space: nowrap;
  text-align: right;
}

/* 関係図パネルヘッダ内の filter-bar は下余白を付けない（一覧の .filter-bar とは別） */
.dashboard-flow-panel__head .dashboard-flow-panel__producer-filter {
  margin-bottom: 0;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 5px;
}

.dashboard-flow-panel__head .dashboard-flow-panel__producer-filter .filter-btn {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
}

.dashboard-history-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.dashboard-history-block {
  display: grid;
  gap: 6px;
}

.dashboard-history-item {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding-top: 6px;
  border-top: 1px solid #edf1f6;
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-history-time {
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dashboard-history-copy,
.dashboard-history-main,
.dashboard-history-detail {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-history-copy {
  display: block;
}

.dashboard-history-main {
  color: var(--primary, #2563eb);
}

.dashboard-history-detail {
  color: var(--text-subtle);
}

.dashboard-history-more {
  display: grid;
  gap: 6px;
}

.dashboard-history-more > .dashboard-history-list--more {
  order: 1;
}

.dashboard-history-more__summary {
  order: 2;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid #d7dee9;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  list-style: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}

.dashboard-history-more__summary::-webkit-details-marker {
  display: none;
}

.dashboard-history-more__label--open,
.dashboard-history-more[open] .dashboard-history-more__label--closed {
  display: none;
}

.dashboard-history-more[open] .dashboard-history-more__label--open {
  display: inline;
}

.dashboard-history-list--more .dashboard-history-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.fg-diagram {
  display: block;
  width: 100%;
  height: auto;
  font-family: system-ui, -apple-system, sans-serif;
}

.fg-node-bg {
  fill: #fff;
  stroke: #d0d7de;
  stroke-width: 1.2;
}

a:hover .fg-node-bg {
  stroke: #4a7dff;
  stroke-width: 1.8;
}

.admin-section-head h2 {
  margin-bottom: 6px;
}

/* 管理一覧: コンテナ（ブラウザ幅）に合わせて広げるが、内容幅未満には縮めない */
.table.admin-table {
  width: 100%;
  min-width: max-content;
  max-width: none;
}

.admin-table th,
.admin-table td {
  vertical-align: top;
  white-space: nowrap;
}

.admin-table th {
  white-space: nowrap;
}

.admin-cell-ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-cell-w-xs {
  max-width: 56px;
}

.admin-cell-w-sm {
  max-width: 104px;
}

.admin-cell-w-md {
  max-width: 132px;
}

.admin-cell-w-lg {
  max-width: 180px;
}

.admin-cell-w-xl {
  max-width: 240px;
}

.admin-cell-w-date {
  max-width: 132px;
}

.admin-cell-w-guid {
  max-width: 96px;
}

.table td.admin-cell-num,
.panel table td.admin-cell-num,
.admin-cell-ellipsis.admin-cell-num {
  text-align: right;
}

.admin-cell-ellipsis mark {
  padding: 0 2px;
  border-radius: 4px;
  background: #fff1a8;
  color: inherit;
}

.farmer-member-code-cell {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 6px;
}

.farmer-member-code-cell .admin-cell-ellipsis {
  min-width: 0;
}

.farmer-duplicate-member-code-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 20px;
  padding: 0 7px;
  border: 1px solid #f4c56b;
  border-radius: 999px;
  background: #fff7df;
  color: #7c4a03;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.admin-filter-match {
  display: inline-block;
  max-width: 100%;
  padding: 0 2px;
  border-radius: 4px;
  background: #fff1a8;
}

.admin-cell-icon {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.admin-checkmark {
  display: inline-block;
  width: 22px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1.5px solid var(--text);
  background-color: #fff;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5.5 4.1 8.5 11 1.5' fill='none' stroke='%232d5da1' stroke-width='2.1' stroke-linecap='square' stroke-linejoin='miter'/%3E%3C/svg%3E");
}

.admin-row-link {
  cursor: pointer;
}

.admin-row-link:hover td {
  background: rgba(45, 93, 161, 0.04);
}

.admin-row-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

select,
textarea,
input {
  min-height: 44px;
  padding: 0 14px;
  color: var(--text);
  background-color: #fff;
  border: 1px solid var(--border-strong);
  /* label { font-weight: 700 } 配下でも入力文字は通常字重にする */
  font-weight: 400;
}

/* After shared padding: reserve space for the custom select chevron */
select {
  padding-right: 38px;
}

/* テキスト系 input と select はボタンと同様のピル型。checkbox / radio / hidden は除外 */
select,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  border-radius: 999px;
  overflow: hidden;
}

input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
}

/* WebKit: date input internals use transparent fill so the outer pill radius reads cleanly */
input[type="date"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
  padding: 0;
  background: transparent;
  color: inherit;
}

select:focus,
textarea:focus,
input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(45, 93, 161, 0.14);
}

select:disabled {
  color: var(--text-muted, #888);
  background-color: var(--bg-muted, #f0f0f0);
  border-color: var(--border, #ddd);
  cursor: not-allowed;
}

textarea:disabled,
input:disabled {
  color: var(--text-muted, #888);
  background-color: var(--bg-muted, #f0f0f0);
  border-color: var(--border, #ddd);
  cursor: not-allowed;
}

textarea {
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 14px;
  line-height: 1.5;
  resize: none;
  overflow: hidden;
}

.file-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.file-input-trigger {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.file-input-control {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.farmer-check {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  box-sizing: border-box;
  width: 22px;
  min-width: 22px;
  max-width: 22px;
  height: 22px;
  min-height: 22px;
  max-height: 22px;
  aspect-ratio: 1 / 1;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  border: 1.5px solid #9fb3d8;
  background: #fff;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94);
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.farmer-table th:first-child,
.farmer-table td:first-child {
  width: 52px;
}

.farmer-check:hover {
  border-color: #7a9bcb;
  box-shadow:
    0 0 0 4px rgba(45, 93, 161, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.farmer-check:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(45, 93, 161, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.farmer-check:checked {
  border-color: var(--text);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5.5 4.1 8.5 11 1.5' fill='none' stroke='%232d5da1' stroke-width='2.1' stroke-linecap='square' stroke-linejoin='miter'/%3E%3C/svg%3E");
}

.farmer-check:indeterminate {
  border-color: var(--text);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M2 5h8' fill='none' stroke='%232d5da1' stroke-width='2.1' stroke-linecap='square'/%3E%3C/svg%3E");
}

.farmer-card-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  font-size: 14px;
}

.admin-content.admin-content--bulk-bar-visible {
  padding-bottom: calc(128px + env(safe-area-inset-bottom));
}

.admin-sidebar.admin-sidebar--bulk-bar-visible .admin-nav {
  padding-bottom: calc(148px + env(safe-area-inset-bottom));
}

.button.admin-bulk-delete-btn {
  background: var(--danger);
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--danger) 88%, #000);
  box-shadow: 0 1px 2px rgba(197, 34, 31, 0.22);
}

.button.admin-bulk-delete-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 86%, #000);
  border-color: color-mix(in srgb, var(--danger) 78%, #000);
  color: #fff;
}

.button.admin-bulk-delete-btn:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

.top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.top-links a {
  color: var(--primary);
  font-weight: 500;
}

dialog {
  width: min(1080px, calc(100vw - 24px));
  max-height: min(88vh, 920px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
}

dialog::backdrop {
  background: rgba(32, 33, 36, 0.38);
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(32, 33, 36, 0.28);
  backdrop-filter: blur(4px);
}

.app-modal-wide .modal-card {
  width: min(1040px, calc(100vw - 32px));
}

.modal-card {
  width: min(760px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
}

.modal-header {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.modal-header p {
  margin: 8px 0 0;
  color: var(--text-subtle);
  font-size: 13px;
  line-height: 1.6;
}

.receiving-detail-label-num-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.receiving-detail-label-num-value {
  min-width: 0;
}

.receiving-detail-label-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
  justify-content: flex-end;
}

.receiving-detail-sections {
  display: grid;
  gap: 16px;
}

.receiving-detail-section {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.receiving-detail-section > h3 {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--text) 3%, var(--surface));
  font-size: 15px;
}

.receiving-detail-section > .table {
  margin: 0;
}

.receiving-detail-section-loading {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.receiving-detail-section-loading > h3 {
  border-bottom-color: color-mix(in srgb, var(--primary) 22%, var(--border));
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
  color: var(--primary);
}

.receiving-edit-history {
  margin-top: 28px;
}

.receiving-edit-history h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.receiving-edit-history-list {
  display: grid;
  gap: 10px;
}

.receiving-edit-history-item {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.receiving-edit-history-item summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.receiving-edit-history-item summary::-webkit-details-marker {
  display: none;
}

.receiving-edit-history-table {
  margin: 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.receiving-edit-history-table th,
.receiving-edit-history-table td {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.modal-body {
  padding: 24px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.receiving-edit-identifier-note {
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 28%, var(--border));
  border-radius: 12px;
  background: var(--warning-subtle);
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.receiving-edit-section {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 18px 20px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.receiving-edit-section legend {
  padding: 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.receiving-edit-section-loading {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  background: color-mix(in srgb, var(--primary) 3%, var(--surface));
}

.service-ja-format-fieldset {
  margin: 0;
  padding: 18px 20px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.service-ja-format-fieldset legend {
  padding: 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.service-ja-format-options {
  display: grid;
  gap: 12px;
}

.service-ja-format-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.service-ja-format-option__body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.service-ja-format-option__label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
}

.service-ja-format-option__body .subtle {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
}

.farmer-detail-report-links-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
}

.farmer-detail-report-pdf-link {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.farmer-detail-report-pdf-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  line-height: 0;
}

.farmer-detail-report-pdf-icon-svg {
  display: block;
  width: auto;
  height: 1.55em;
  flex-shrink: 0;
}

.farmer-detail-report-link-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.farmer-detail-report-date {
  font-size: 11px;
  color: var(--color-text-subtle);
  white-space: nowrap;
  padding-left: 2px;
}

.account-password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.account-password-generate {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .account-password-field {
    grid-template-columns: 1fr;
  }
}

.csv-preview-modal-body {
  display: grid;
  gap: 16px;
  align-content: start;
}

.csv-preview-modal-body .modal-footer {
  padding: 0;
}

.csv-preview-modal-body .action-row {
  margin: 0;
}

.csv-preview-more-label {
  margin: 12px 0 0;
  color: var(--text-subtle);
  font-size: 13px;
  font-weight: 600;
}

.modal-footer {
  flex-shrink: 0;
  padding: 0;
  margin-top: 16px;
}

.modal-footer .button,
.modal-footer button:not(.machine-modal-trash) {
  border-radius: 999px;
}

.modal-action-footer {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.modal-action-footer__main {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.modal-close-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -6px -10px -6px 8px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
}

.modal-close-icon:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.modal-close-icon:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.modal-close-icon svg {
  display: block;
}

.machine-modal-trash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--danger) 88%, #000);
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(197, 34, 31, 0.22);
}

.machine-modal-trash:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 86%, #000);
  color: #fff;
}

.machine-modal-trash:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

.machine-modal-trash svg {
  display: block;
  stroke: #fff;
}

.dialog-card {
  overflow: auto;
  max-height: inherit;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(26, 115, 232, 0.16);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-header h2 {
  margin: 0 0 6px;
}

.print-button {
  position: fixed;
  top: 16px;
  right: 16px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}

.sheet {
  width: min(840px, 100%);
  margin: 0 auto;
}

.page-break {
  page-break-before: always;
}

.label-card,
.slip-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
}

.label-card {
  min-height: calc(100vh - 80px);
  padding: 28px;
  display: grid;
  gap: 16px;
  justify-items: center;
  align-content: center;
  text-align: center;
}

.label-id {
  font-size: 30px;
  font-weight: 800;
}

.label-qr img {
  width: 220px;
  height: 220px;
}

.label-title {
  font-size: 26px;
  font-weight: 800;
}

.label-line {
  font-size: 19px;
}

.label-date,
.label-pager {
  color: var(--text-subtle);
  font-size: 15px;
}

.slip-card {
  padding: 28px;
  display: grid;
  gap: 18px;
}

.slip-title {
  font-size: 30px;
  font-weight: 800;
  text-align: center;
}

.slip-grid {
  display: grid;
  gap: 10px;
}

.slip-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dotted var(--border-strong);
}

.slip-label {
  color: var(--text-subtle);
  font-weight: 700;
}

.slip-value {
  font-weight: 700;
}

.slip-barcode {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin-top: 12px;
}

.slip-barcode img {
  max-width: 100%;
}

.slip-barcode-text {
  letter-spacing: 0.24em;
  font-size: 16px;
  font-family: "SFMono-Regular", Consolas, monospace;
}

@media print {
  .no-print {
    display: none;
  }
}

/* 管理：荷受アプリスコープ（マスタ・荷受一覧の本文上） */
.admin-intake-scope-panel {
  background: var(--surface);
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.admin-intake-scope-panel--empty {
  margin-bottom: 16px;
}

.admin-intake-scope-panel__label {
  display: none;
}

.admin-intake-scope-panel__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.admin-intake-scope-segment {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px;
}

.admin-intake-scope-segment-btn {
  border: 1px solid var(--border);
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
}

.admin-intake-scope-segment-btn:hover {
  background: #f3f4f6;
}

.admin-intake-scope-segment-btn[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.admin-intake-scope-segment-btn[aria-pressed="true"]:hover {
  border-color: var(--primary);
}

.admin-intake-scope-segment-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  main {
    padding: 20px 14px 60px;
  }

  .admin-topbar {
    height: 56px;
    padding: 0 14px;
  }

  .admin-sidebar-toggle {
    display: inline-flex;
  }

  .admin-layout {
    grid-template-columns: 1fr;
    position: relative;
  }

  .admin-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    z-index: 80;
    width: min(320px, 86vw);
    border-right: 1px solid #e5e5e5;
    border-bottom: none;
    box-shadow: var(--shadow-md);
    transform: translateX(-100%);
    transition: transform var(--duration) var(--ease);
  }

  .admin-nav {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .nav-section {
    width: 100%;
  }

  body.admin-sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-sidebar-overlay {
    position: fixed;
    inset: 56px 0 0 0;
    z-index: 70;
    border: 0;
    background: rgba(15, 15, 15, 0.28);
    display: none;
    padding: 0;
    cursor: pointer;
  }

  body.admin-sidebar-open .admin-sidebar-overlay {
    display: block;
  }

  .admin-content {
    padding: 20px 14px 60px;
  }

  .hero,
  .card,
  .panel,
  .table-card,
  .metric,
  .label-card,
  .slip-card {
    border-radius: 20px;
  }

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

  .slip-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
