:root {
  color-scheme: light;
  --ink: #17302c;
  --muted: #60716d;
  --line: #d8e3df;
  --paper: #ffffff;
  --canvas: #f1f6f4;
  --green: #0f766e;
  --green-dark: #0a554f;
  --green-soft: #e3f4f1;
  --navy: #173f4a;
  --sand: #f5efe3;
  --amber: #9a6200;
  --amber-soft: #fff3d5;
  --red: #b52f36;
  --red-soft: #fdebed;
  --shadow: 0 10px 30px rgba(20, 55, 48, .08);
  --shadow-raised: 0 18px 46px rgba(20, 55, 48, .13);
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 85% 0, #e1f1ed 0, transparent 32rem), var(--canvas); font-family: system-ui, "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif; }
a { color: var(--green-dark); }
button, input, select { font: inherit; }
button, .button { touch-action: manipulation; }
.site-header { min-height: 68px; padding: 8px max(16px, env(safe-area-inset-left)); background: rgba(255,255,255,.94); border-bottom: 1px solid rgba(188, 207, 201, .8); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.header-inner { width: min(1120px, 100%); min-height: 51px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark, .login-mark { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; color: #fff; background: linear-gradient(145deg, var(--navy), var(--green)); box-shadow: 0 6px 14px rgba(15, 118, 110, .2); font-weight: 900; }
.brand-copy { display: grid; line-height: 1.08; }
.brand-copy strong { font-size: .98rem; letter-spacing: .04em; }
.brand-copy small { margin-top: 4px; color: var(--green); font-size: .58rem; font-weight: 800; letter-spacing: .16em; }
.userbar { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .86rem; }
.userbar form { margin: 0; }
.dashboard-link { padding: 8px; color: var(--green-dark); font-weight: 750; text-decoration: none; }
.role-badge { border: 1px solid #c9dad5; border-radius: 999px; background: #f7faf9; padding: 6px 10px; white-space: nowrap; }
.logout-button { min-height: 38px; border: 1px solid #ccd8d4; border-radius: 9px; background: #eef3f1; color: var(--ink); padding: 7px 12px; cursor: pointer; }
.logout-button:hover { border-color: #aebfba; background: #e3ebe8; }
.page { width: min(1120px, calc(100% - 28px)); margin: 28px auto 70px; }
.site-footer { padding: 0 18px 28px; color: #7b8b87; text-align: center; font-size: .76rem; }
.back { display: inline-block; margin-bottom: 18px; text-decoration: none; font-weight: 700; }
.title-row, .section-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.title-row { margin-bottom: 20px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(1.7rem, 4vw, 2.35rem); line-height: 1.25; }
h2 { font-size: 1.15rem; }
.eyebrow, .section-kicker { margin-bottom: 6px; color: var(--green); font-weight: 900; font-size: .72rem; letter-spacing: .16em; }
.section-kicker { margin-bottom: 3px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: clamp(18px, 3vw, 28px); margin-bottom: 18px; }
.login-card { width: min(440px, 100%); margin: 7vh auto 0; }
.login-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.login-heading h1 { margin: 0; font-size: 1.45rem; }
.login-heading .eyebrow { margin-bottom: 3px; }
.login-mark { width: 50px; height: 50px; border-radius: 15px; font-size: 1.25rem; }
.login-lead { margin-bottom: 22px; color: var(--muted); }
.stack-form { display: grid; gap: 18px; }
.stack-form label { display: grid; gap: 8px; font-weight: 800; }
input, select { width: 100%; min-height: 48px; border: 1px solid #b9c3be; border-radius: 10px; background: white; padding: 10px 12px; color: var(--ink); }
input:focus, select:focus { outline: 3px solid rgba(23, 107, 77, .18); border-color: var(--green); }
button, .button { border: 0; border-radius: 10px; min-height: 46px; padding: 11px 18px; font-weight: 800; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--green); color: #fff; }
.primary:hover { background: var(--green-dark); }
.secondary { background: #e7ece9; color: var(--ink); }
.danger { background: var(--red); color: #fff; }
.wide { width: 100%; }
.notice { padding: 14px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 700; }
.notice.error { background: var(--red-soft); color: #8d2027; border: 1px solid #efbbc0; }
.notice.warning { background: var(--amber-soft); color: #754b00; border: 1px solid #efd28f; }
.notice.success { background: var(--green-soft); color: var(--green-dark); border: 1px solid #bcdccb; }
.upload-box { border: 2px dashed #aebbb4; border-radius: 14px; padding: 18px; background: #f9fbfa; }
.upload-box input { min-height: auto; border: 0; padding: 6px 0; }
.upload-box span { color: var(--green); font-weight: 700; word-break: break-all; }
.hint { color: var(--muted); font-size: .9rem; margin-bottom: 0; }
.center { text-align: center; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.metric { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 4px; }
.metric span { color: var(--muted); font-size: .85rem; }
.metric strong { font-size: 1.7rem; }
.metric.difference strong, .diff { color: var(--red); }
.ok { color: var(--green); }
.session-grid { display: grid; gap: 10px; }
.session-card, .history-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: #fbfcfb; transition: border-color .14s, transform .14s, box-shadow .14s; }
.session-card:hover, .history-row:hover { border-color: #9ec7bd; box-shadow: 0 8px 18px rgba(20, 55, 48, .07); transform: translateY(-1px); }
.session-card span, .history-row span { color: var(--muted); }
.session-date { font-weight: 800; color: var(--ink) !important; }
.session-progress { display: grid; justify-items: end; }
.session-progress strong { color: var(--green-dark); font-size: 1.08rem; }
.session-progress small { color: var(--muted); }
.history-row + .history-row { margin-top: 10px; }
.history-row > div { display: grid; gap: 5px; }
.status { display: inline-flex; align-items: center; border-radius: 999px; padding: 7px 12px; font-weight: 800; white-space: nowrap; }
.status.in_progress { background: var(--amber-soft); color: var(--amber); }
.status.completed { background: var(--green-soft); color: var(--green-dark); }
.status.cancelled { background: #ececec; color: #666; }
.empty { min-height: 90px; display: grid; place-content: center; text-align: center; gap: 5px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 10px; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .85rem; background: #f7f9f8; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.filters { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.tabs { display: flex; background: #edf1ef; border-radius: 10px; padding: 3px; }
.tabs a { padding: 9px 13px; text-decoration: none; border-radius: 8px; font-weight: 800; color: var(--muted); }
.tabs a.active { background: white; color: var(--green-dark); box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.search { display: flex; gap: 7px; }
.search input { min-height: 42px; }
.search button { min-height: 42px; background: #e1e7e4; }
.product-list, .lot-list { display: grid; gap: 10px; }
.product-row, .lot-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: #fff; }
.product-row:hover, .lot-row:hover { border-color: var(--green); background: #fbfefc; }
.product-row > div:first-child, .lot-row > div:first-child { display: grid; gap: 4px; }
.product-code { font-size: 1.06rem; }
.row-stats, .lot-qty { min-width: 135px; display: grid; justify-items: end; gap: 4px; font-variant-numeric: tabular-nums; }
.row-stats span, .lot-row small, .lot-qty span { color: var(--muted); }
.lot-row.required { border-width: 2px; border-color: #d7b252; }
.lot-badge { display: inline-flex; width: fit-content; padding: 4px 9px; border-radius: 999px; font-size: .78rem; font-weight: 900; }
.lot-badge.required { color: #684200; background: var(--amber-soft); }
.lot-badge.optional { color: var(--green-dark); background: var(--green-soft); }
.quantity-compare { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 12px; margin-bottom: 20px; }
.quantity-compare > div { border: 1px solid var(--line); background: #fafcfb; border-radius: 14px; padding: 16px; display: grid; gap: 8px; place-items: center; }
.quantity-compare span, .quantity-compare label { color: var(--muted); font-weight: 800; }
.quantity-compare strong { font-size: 2rem; font-variant-numeric: tabular-nums; }
.counter { display: grid; grid-template-columns: 48px minmax(90px, 160px) 48px; gap: 6px; }
.counter button { background: #e2e9e5; font-size: 1.5rem; padding: 4px; }
.counter input { text-align: center; font-size: 1.5rem; font-weight: 900; }
.calculator-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.calculator-head output { min-width: 150px; border-radius: 10px; background: #1d2923; color: white; padding: 12px 16px; text-align: right; font: 700 1.6rem ui-monospace, monospace; }
.calculator-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.calculator-keys button { min-height: 58px; font-size: 1.2rem; background: #e9eeeb; }
.calculator-keys [data-operator], .calculator-keys .equals { background: #dcebe4; color: var(--green-dark); }
.calculator-keys .zero { grid-column: span 2; }
.danger-zone { margin-top: 28px; color: var(--red); }
.danger-zone summary { cursor: pointer; }
.danger-zone form { margin-top: 12px; }

/* 荷主別ダッシュボード */
.dashboard-hero { position: relative; overflow: hidden; margin-bottom: 30px; border: 1px solid #bdd9d2; border-radius: 24px; padding: clamp(26px, 5vw, 46px); background: linear-gradient(125deg, #ffffff 5%, #e7f4f0 68%, #d7ede7); box-shadow: var(--shadow); }
.dashboard-hero::after { content: ""; position: absolute; right: -70px; top: -105px; width: 280px; height: 280px; border: 42px solid rgba(15, 118, 110, .08); border-radius: 50%; }
.dashboard-hero h1 { position: relative; max-width: 720px; margin-bottom: 10px; font-size: clamp(1.8rem, 4vw, 2.7rem); }
.dashboard-hero p:last-child { position: relative; margin-bottom: 0; color: var(--muted); font-size: 1rem; }
.dashboard-section-title { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 0 2px 14px; }
.dashboard-section-title h2, .section-title h2 { margin: 0; }
.role-note { color: var(--muted); font-size: .82rem; }
.shipper-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.shipper-card { min-height: 330px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.shipper-card.foodcare-card { border-top: 4px solid var(--green); }
.shipper-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 24px 0; }
.shipper-monogram { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; background: linear-gradient(145deg, var(--navy), var(--green)); color: white; font-weight: 900; letter-spacing: .04em; box-shadow: 0 7px 16px rgba(15, 118, 110, .2); }
.shipper-monogram.otsuka { background: linear-gradient(145deg, #6c665b, #999083); box-shadow: none; }
.shipper-status { border-radius: 999px; padding: 6px 10px; font-size: .72rem; font-weight: 850; }
.shipper-status.active { color: #784a00; background: var(--amber-soft); }
.shipper-status.ready { color: var(--green-dark); background: var(--green-soft); }
.shipper-status.planned { color: #625e56; background: #eeeae3; }
.shipper-card-body { padding: 20px 24px 16px; }
.shipper-label { margin-bottom: 4px; color: var(--green); font-size: .7rem; font-weight: 900; letter-spacing: .16em; }
.shipper-card-body h3 { margin: 0 0 10px; font-size: 1.5rem; }
.shipper-card-body > p:last-child { min-height: 3em; margin-bottom: 0; color: var(--muted); line-height: 1.65; }
.shipper-card-meta { min-height: 54px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; margin: auto 24px 20px; border-top: 1px solid var(--line); padding-top: 15px; color: var(--muted); font-size: .82rem; }
.shipper-card-meta strong { color: var(--green-dark); }
.shipper-action { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--green); color: white; padding: 14px 24px; font-weight: 850; text-decoration: none; }
.shipper-action:hover { background: var(--green-dark); }
.shipper-action span { font-size: 1.25rem; }
.shipper-card.coming-soon { color: #5f625f; background: #f5f5f2; border-top: 4px solid #aaa397; box-shadow: none; }
.shipper-card.coming-soon .shipper-label { color: #777168; }
.muted-meta { color: #858783; }
.shipper-action.disabled { background: #dddcd7; color: #75746f; }

/* 荷主内トップ */
.shipper-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 20px; margin-bottom: 22px; border: 1px solid #bdd9d2; border-radius: 20px; padding: clamp(20px, 4vw, 32px); background: linear-gradient(120deg, #fff, #e6f3ef); box-shadow: var(--shadow); }
.shipper-monogram.large { width: 68px; height: 68px; border-radius: 19px; font-size: 1.15rem; }
.shipper-hero h1 { margin-bottom: 5px; }
.hero-copy { max-width: 650px; margin: 0; color: var(--muted); line-height: 1.6; }
.hero-action { white-space: nowrap; }
.count-badge { display: inline-grid; place-items: center; min-width: 38px; min-height: 30px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); padding: 5px 10px; font-size: .8rem; font-weight: 850; }
.text-link { font-size: .86rem; font-weight: 800; text-decoration: none; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(15, 118, 110, .3); outline-offset: 3px; }

@media (max-width: 700px) {
  .page { width: min(100% - 20px, 1040px); margin-top: 16px; }
  .site-header { min-height: 62px; }
  .brand-copy small, .dashboard-link { display: none; }
  .brand-mark { width: 35px; height: 35px; }
  .role-badge { max-width: 105px; overflow: hidden; text-overflow: ellipsis; }
  .logout-button { padding-inline: 9px; }
  .title-row { align-items: flex-start; }
  .dashboard-hero { margin-bottom: 24px; padding: 24px 20px; }
  .dashboard-hero::after { right: -130px; }
  .dashboard-section-title { align-items: flex-start; }
  .shipper-grid { grid-template-columns: 1fr; }
  .shipper-card { min-height: 310px; }
  .shipper-hero { grid-template-columns: auto 1fr; }
  .shipper-hero .hero-action { grid-column: span 2; width: 100%; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .metric { padding: 11px; }
  .metric strong { font-size: 1.3rem; }
  .filters { align-items: stretch; flex-direction: column; }
  .tabs { width: 100%; }
  .tabs a { flex: 1; text-align: center; }
  .search input { min-width: 0; }
  .search button { flex: none; }
  .product-row, .lot-row { align-items: flex-start; }
  .row-stats, .lot-qty { min-width: 92px; }
  .quantity-compare { grid-template-columns: 1fr 1fr; }
  .quantity-compare > div:nth-child(2) { grid-column: span 2; grid-row: 2; }
  .calculator-head { align-items: stretch; flex-direction: column; }
  .calculator-head output { width: 100%; }
}

@media (max-width: 430px) {
  .header-inner { gap: 8px; }
  .brand { gap: 7px; }
  .brand-copy strong { font-size: .84rem; }
  .userbar { gap: 6px; }
  .role-badge { max-width: 86px; font-size: .76rem; padding-inline: 8px; }
  .logout-button { font-size: .78rem; }
  .shipper-card-top, .shipper-card-body { padding-inline: 19px; }
  .shipper-card-meta { margin-inline: 19px; }
  .shipper-action { padding-inline: 19px; }
  .shipper-hero { grid-template-columns: 1fr; }
  .shipper-hero .hero-action { grid-column: auto; }
  .shipper-monogram.large { width: 55px; height: 55px; }
}
