: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-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-subtle {
  margin-top: 0;
  color: var(--text-subtle);
  font-size: 13px;
}

.admin-env-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--danger) 16%, white);
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.admin-topbar-intake {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.admin-topbar-intake__label {
  font-size: 12px;
  color: var(--text-subtle);
  white-space: nowrap;
}

.admin-topbar-intake__select {
  min-width: 180px;
  max-width: 320px;
}

/* ---- 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;
}

.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;
}

.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;
}

.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;
}

.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;
}

.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.member-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;
}

.table tr:last-child td,
.panel table tr:last-child 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;
}

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

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

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

.member-table tbody tr.member-row-selected .button.button-secondary,
.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);
}

.member-table tbody tr.member-row-selected .button.button-secondary:hover,
.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: 6px;
  align-items: start;
}

.csv-preview-value {
  display: inline-block;
}

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

.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;
}

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

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

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

.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--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-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-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;
}

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

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

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

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

.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:
    radial-gradient(circle at top left, rgba(66, 133, 244, 0.12), transparent 32%),
    radial-gradient(circle at top right, rgba(22, 163, 74, 0.12), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  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;
}

.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 {
  font-weight: 700;
}

.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;
}

.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: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  /* label { font-weight: 700 } 配下でも入力文字は通常字重にする */
  font-weight: 400;
}

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,
textarea:disabled,
input:disabled {
  color: var(--text-muted, #888);
  background: var(--bg-muted, #f0f0f0);
  border-color: var(--border, #ddd);
  cursor: not-allowed;
}

textarea {
  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;
}

.member-check,
.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,
.member-table th:first-child,
.member-table td:first-child {
  width: 52px;
}

.member-check:hover,
.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);
}

.member-check:focus-visible,
.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);
}

.member-check:checked,
.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");
}

.member-check:indeterminate,
.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");
}

tr:has(.member-check),
tr:has(.farmer-check) {
  cursor: pointer;
}

tr:has(.member-check):hover,
tr:has(.farmer-check):hover {
  background: var(--bg-hover, rgba(26, 115, 232, 0.04));
}

.member-selection-bar,
.farmer-selection-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;
}

.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;
}

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

.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;
}

.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;
}

.csv-preview-warning-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-body);
  display: grid;
  gap: 8px;
}

.csv-preview-apply-form {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.csv-preview-inline-field {
  display: grid;
  gap: 6px;
  width: min(360px, 100%);
  text-align: left;
  font-size: 13px;
  color: var(--text-subtle);
}

.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;
  }
}
