/* FUJII inventory - shared visual conventions with FUJII 工程管理.
 * Desktop: fixed light sidebar. Mobile/tablet: offcanvas menu and card lists.
 * Stock/business rules stay in Python; CSS never hides relevant data.
 */
:root {
  --blue: #2B5CC4;
  --blue-dark: #1B469C;
  --pale: #E8F1FF;
  --navy: #1F2937;
  --text: #1F2937;
  --muted: #536176;
  --border: #E5E7EB;
  --bg: #F8FAFC;
  --red: #AD3C2F;
  --sidebar-width: 210px;
  --bs-primary: #2B5CC4;
  --bs-primary-rgb: 43, 92, 196;
  --bs-link-color: #2B5CC4;
  --bs-link-hover-color: #1B469C;
}
*, *::before, *::after { box-sizing: border-box; }
html { min-width: 0; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui,-apple-system,"Yu Gothic","Meiryo",sans-serif; font-size: 15px; line-height: 1.55; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }
button, .btn { cursor: pointer; font-family: inherit; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* Navigation: same structure and blue/light sidebar as FUJII 工程管理. */
.app-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); background: var(--bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; color: var(--text); z-index: 1050; }
.sidebar-header { display: flex; align-items: center; padding: 14px 12px 8px; }
.sidebar-brand { display: flex; align-items: center; min-height: 64px; padding-bottom: 10px; width: 100%; border-bottom: 1px solid var(--border); }
.brand-wordmark { width: 100%; max-height: 70px; object-fit: contain; object-position: left center; }
.sidebar-mobile-close { display: none; border: 0; background: transparent; color: var(--muted); font-size: 26px; padding: 2px 9px; }
.sidebar-nav { padding: 0 10px 12px; flex: 1; }
.nav-section-label { color: #687588; font-size: 12px; font-weight: 700; letter-spacing: .025em; padding: 20px 11px 5px; }
.sidebar-link { display: block; position: relative; color: #334155; font-size: 14px; font-weight: 600; padding: 10px 12px; margin-bottom: 4px; border-radius: 8px; border: 1px solid transparent; }
.sidebar-link:hover, .sidebar-link:focus-visible { color: var(--blue-dark); background: var(--pale); text-decoration: none; }
.sidebar-link.active { color: var(--blue); background: var(--pale); font-weight: 750; }
.sidebar-link.active::before { content: ''; width: 3px; background: var(--blue); position: absolute; left: 0; top: 8px; bottom: 8px; border-radius: 0 3px 3px 0; }
.sidebar-footer { border-top: 1px solid var(--border); padding: 16px; color: var(--muted); font-size: 11px; }
.app-layout { margin-left: var(--sidebar-width); min-width: 0; }
.app-topbar { height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 27px; background: #fff; border-bottom: 1px solid var(--border); }
.topbar-leading { display: flex; align-items: center; gap: 15px; min-width: 0; }
.breadcrumb-label { color: #526175; font-size: 13px; white-space: nowrap; }
.breadcrumb-label span { margin: 0 10px; color: #B5BCC8; }
.mobile-nav-trigger, .topbar-mobile-brand { display: none; }
.account-toggle { border: 0; background: transparent; color: var(--navy); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 8px; max-width: 240px; }
.account-toggle:hover, .account-toggle:focus-visible { background: var(--pale); }
.account-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-arrow { color: var(--muted); flex-shrink: 0; }
.account-menu { min-width: 180px; padding: 7px 0; border-color: var(--border); box-shadow: 0 8px 24px rgba(31,41,55,.1); }
.account-identity { font-size: 13px; font-weight: 600; padding: 8px 15px; color: var(--text); }
.account-identity small { display: block; color: var(--muted); font-weight: 400; }
.logout-form { margin: 0; }
.app-main { min-width: 0; padding: 22px 26px 0; }
.shell { max-width: 1350px; min-width: 0; margin: 0 auto; }
.footer { padding: 36px 0 24px; color: var(--muted); font-size: 12px; }

/* Consistent content elements. */
h1, h2, h3 { color: var(--navy); }
.page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin: 8px 0 21px; }
.page-heading h1, .shell > h1 { margin: 0; font-size: 25px; font-weight: 650; }
.page-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.back { display: block; font-size: 13px; margin-bottom: 6px; }
.stock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%,260px), 1fr)); gap: 15px; }
.stock-card, .panel, .stat, .item { background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 1px 2px rgba(13,43,77,.025); min-width: 0; }
.stock-card { padding: 23px; display: block; color: var(--text); }
.stock-card:hover { border-color: #ADC2DD; text-decoration: none; }
.stock-card h2 { font-size: 22px; margin: 6px 0 23px; }
.stock-card-bottom { display: flex; gap: 12px; justify-content: space-between; font-size: 13px; flex-wrap: wrap; }
.small, .hint { font-size: 13px; color: var(--muted); }
.red { color: var(--red)!important; }
.muted { color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; margin: 18px 0; }
.stat { display: flex; align-items: center; gap: 12px; padding: 19px; color: var(--text); }
.stat strong { font-size: 26px; color: var(--blue); }
.stat span { color: var(--muted); font-size: 13px; }
.panel { padding: 21px; margin: 17px 0; }
.panel h2 { font-size: 19px; margin: 0 0 14px; }
.panel h3 { font-size: 16px; margin: 10px 0; }
.section-title { font-size: 20px; margin: 29px 0 8px; }
.actions, .row-between { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.actions { margin: 19px 0; }
.row-between { justify-content: space-between; }
.row-between h3 { margin: 0; }
.btn, button.primary, button.secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 15px; border-radius: 7px; border: 1px solid transparent; font-size: 14px; font-weight: 600; line-height: 1.5; text-decoration: none; white-space: normal; }
.btn.primary, button.primary { background: var(--blue); color: #fff!important; border-color: var(--blue); }
.btn.secondary, button.secondary { background: #fff; color: var(--blue)!important; border-color: #AABBD2!important; }
.btn:hover, button.primary:hover, button.secondary:hover { filter: brightness(.97); text-decoration: none; }
.wide { width: 100%; }
.narrow { max-width: 640px; }
.form { display: flex; flex-direction: column; gap: 15px; }
.form.compact { gap: 10px; margin-top: 16px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; min-width: 0; }
.form em { font-size: 11px; font-style: normal; color: var(--red); }
input:not([type=checkbox]):not([type=radio]), select, textarea { font: inherit; color: var(--text); padding: 10px 12px; border-radius: 7px; border: 1px solid #BBC8D8; background: #fff; width: 100%; max-width: 100%; min-width: 0; min-height: 42px; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 18px; flex: 0 0 18px; accent-color: var(--blue); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #C7DBFA; border-color: var(--blue); }
.search { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin: 15px 0 22px; }
.notice { border: 1px solid #C9D8EA; border-radius: 7px; padding: 12px 15px; background: var(--pale); margin: 15px 0; font-size: 13px; overflow-wrap: anywhere; }
.notice.ok { background: #EEF4FF; border-color: #C7D9F3; color: #254F87; }
.notice.error { background: #FFF0EC; border-color: #F4CCC5; color: #8B3028; }
.withdraw-list-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin: 3px 0 13px; font-size: 14px; }
.withdraw-pagination { display: flex; justify-content: center; flex-wrap: wrap; align-items: center; gap: 8px; margin: 22px 0 4px; }
.withdraw-pagination .page-number, .withdraw-pagination .page-current { min-width: 42px; min-height: 42px; padding: 9px 12px; text-align: center; }
.withdraw-pagination .page-current { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--blue); border-radius: 7px; font-weight: 700; color: #fff; background: var(--blue); }
.withdraw-pagination .small { margin-inline-start: 4px; }
.item-list { display: grid; gap: 12px; }
.item { padding: 17px; }
.item-title { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 9px; }
.item-title strong { font-size: 17px; }
.item-title h2 { margin: 0; }
.right { text-align: right; }
.tag { display: inline-block; border-radius: 5px; padding: 3px 8px; font-size: 11px; color: #50617A; background: #EAF0F6; white-space: normal; }
.tag.warn { color: #84510D; background: #FFF0D1; }
.tag.info { color: #244F97; background: #EAF1FF; }
.multiline-note { white-space: pre-wrap; }
.bin-list { margin: 12px 0; }
.bin { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); min-width: 0; }
.bin > div:first-child { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; min-width: 0; }
.bin-end { display: flex; align-items: center; gap: 15px; min-width: 0; }
.location { background: var(--pale); border-radius: 5px; padding: 4px 8px; font-weight: 700; color: var(--navy); }
.inline-form { display: inline-block; margin: 3px 8px 0 0; }
.link-button { border: 0; background: transparent; color: var(--blue); padding: 4px 0; font-size: 13px; cursor: pointer; }
.table-scroll { max-width: 100%; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 700px; }
th, td { padding: 11px 10px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); font-size: 13px; overflow-wrap: anywhere; }
th { color: var(--muted); background: #F9FBFD; font-size: 12px; font-weight: 650; }
tbody tr:last-child td { border-bottom: 0; }
.qty-field { width: 100px!important; max-width: 100%; }
.twocol, .field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.clean-list { list-style: none; padding: 0; margin: 0; }
.clean-list li { padding: 8px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.receive-form { display: grid; grid-template-columns: 2fr 1fr 1fr auto; align-items: end; }
.details, .compact-details { display: grid; grid-template-columns: 130px minmax(0,1fr); gap: 11px; }
.details dt, .compact-details dt { color: var(--muted); }
.details dd, .compact-details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.empty { background: #fff; border: 1px dashed #B9C7D7; padding: 22px; border-radius: 9px; overflow-wrap: anywhere; }
.login-screen { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(440px,calc(100% - 30px)); padding: 28px; background: white; border-radius: 12px; border: 1px solid var(--border); }
.login-heading { font-size: 23px; font-weight: 800; color: var(--navy); }
.login-heading span { font-size: 17px; font-weight: 400; }
.login-card h1 { font-size: 21px; }
.login-card form { display: grid; gap: 15px; }
.login-card label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; }

/* Analytics, confirmation and management controls. */
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin: 14px 0; }
.metric { border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; gap: 3px; padding: 13px; min-width: 0; }
.metric span, .metric small { color: var(--muted); font-size: 12px; }
.metric strong { color: var(--navy); font-size: 24px; font-weight: 600; }
.mini-facts { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 13px; color: var(--muted); }
.no-wrap { white-space: nowrap; }
.checkbox-inline { display: flex!important; flex-direction: row!important; align-items: center; gap: 8px!important; font-size: 14px!important; }
.checkbox-inline input { width: 18px; min-height: 18px; }
.filter-form { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); align-items: end; gap: 10px; }
.filter-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.filter-form button { align-self: end; }
.undo-form { display: grid; gap: 4px; min-width: 0; margin-top: 6px; }
.undo-form input { min-height: 34px!important; height: 34px; font-size: 12px!important; padding: 6px!important; }
.undo-form button { font-size: 12px!important; padding: 5px 8px!important; min-height: 32px!important; }
.confirm-dialog { width: min(540px,calc(100% - 22px)); max-height: 90vh; overflow: auto; padding: 22px; color: var(--text); background: white; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 20px 65px rgba(0,0,0,.14); }
.confirm-dialog::backdrop { background: rgba(22,39,61,.45); }
.confirm-dialog h2 { margin: 0; font-size: 20px; }
.confirm-dialog p { margin: 0; }
.compact-details { grid-template-columns: 100px minmax(0,1fr); gap: 7px; border-top: 1px solid var(--border); padding-top: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.dialog-actions button { flex: 1; min-width: 120px; }
button[hidden], div[hidden] { display: none!important; }
.package-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.package-row form { margin: 0; }
.package-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 13px; }
.package-actions .link-button { white-space: nowrap; }
.archived-packages { margin-top: 12px; }
.archived-packages summary { cursor: pointer; color: var(--muted); font-size: 13px; }

/* Tablet and phone: no horizontal menu, no sideways-scrolling lists. */
@media (max-width: 991.98px) {
  :root { --sidebar-width: 0px; }
  .app-sidebar { --bs-offcanvas-width: min(290px,88vw); width: min(290px,88vw); background: var(--bg); z-index: 1050; }
  .sidebar-mobile-close { display: inline-flex; }
  .app-layout { margin-left: 0; }
  .app-topbar { height: 55px; padding: 0 15px; }
  .mobile-nav-trigger { display: inline-flex; align-items: center; justify-content: center; width: 41px; height: 41px; background: transparent; color: var(--blue); border: 1px solid var(--border); border-radius: 8px; padding: 9px; }
  .mobile-nav-trigger svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
  .topbar-mobile-brand { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--navy); font-weight: 650; font-size: 14px; white-space: nowrap; }
  .topbar-mobile-brand img { height: 29px; width: 29px; object-fit: contain; }
  .breadcrumb-label { display: none; }
  .app-main { padding: 16px 15px 0; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .twocol, .field-grid { grid-template-columns: 1fr; }
  .table-scroll { overflow: visible; }
  .table-scroll table { min-width: 0; width: 100%; display: block; }
  .table-scroll table thead { display: none; }
  .table-scroll table tbody { display: grid; gap: 10px; width: 100%; }
  .table-scroll table tbody tr { display: block; background: #fff; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
  .table-scroll table tbody tr td { display: grid; grid-template-columns: minmax(0,108px) minmax(0,1fr); gap: 9px; align-items: start; width: 100%; padding: 7px 0; border: 0; min-width: 0; font-size: 13px; text-align: left; overflow-wrap: anywhere; }
  .table-scroll table tbody tr td + td { border-top: 1px solid #F0F3F7; }
  .table-scroll table tbody tr td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
  .table-scroll table tbody tr td > * { min-width: 0; max-width: 100%; }
  .table-scroll .panel { padding: 10px; }
  .receive-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .bin { flex-wrap: wrap; }
  .bin-end { flex-wrap: wrap; }
  .filter-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stock-filter { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stock-filter .btn { width: 100%; }
}
@media (max-width: 540px) {
  .app-topbar { padding: 0 11px; }
  .account-name { max-width: 105px; }
  .app-main { padding: 14px 10px 0; }
  .panel { padding: 13px; }
  .page-heading { margin: 5px 0 15px; }
  .page-heading h1 { font-size: 22px; }
  .item { padding: 13px; }
  .item-title { flex-wrap: wrap; gap: 8px; }
  .item-title strong { font-size: 15px; }
  .bin > div:first-child { width: 100%; }
  .bin-end { width: 100%; justify-content: space-between; }
  .metric strong { font-size: 21px; }
  .stat { padding: 14px; flex-direction: column; align-items: start; gap: 2px; }
  .stat strong { font-size: 23px; }
  .search { grid-template-columns: minmax(0,1fr) auto; }
  .filter-form { grid-template-columns: 1fr; }
  .stock-filter { grid-template-columns: 1fr 1fr; }
  .details { grid-template-columns: 92px minmax(0,1fr); }
  .table-scroll table tbody tr { padding: 9px 10px; }
  .table-scroll table tbody tr td { grid-template-columns: minmax(0,90px) minmax(0,1fr); gap: 6px; }
  .dialog-actions { display: grid; grid-template-columns: 1fr; }
  .dialog-actions button { width: 100%; }
  .actions form, .actions .btn { max-width: 100%; }
  .package-row { align-items: flex-start; }
}
@media (max-width: 360px) {
  .topbar-mobile-brand span { font-size: 12px; }
  .account-name { max-width: 68px; }
  .stock-filter { grid-template-columns: 1fr; }
  .table-scroll table tbody tr td { grid-template-columns: minmax(0,76px) minmax(0,1fr); }
}

/* Reuse the calm 材料出庫 card pattern on every material screen. */
[hidden] { display: none !important; }
.material-identity { min-width: 0; overflow-wrap: anywhere; }
.material-identity .small { margin-top: 2px; }
.item-title .tag { align-self: flex-start; flex-shrink: 0; }
.item .summary-facts { margin: 12px 0 10px; }
.item .bin-list { margin: 10px 0 0; }
.item .item-actions { margin-top: 13px; }
.item-actions form { margin: 0; }
.empty-stock-note { margin: 10px 0; }
.request-memo { margin: 10px 0 0; overflow-wrap: anywhere; }
.request-entry { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; align-items: end; }
.request-entry label { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; font-weight: 600; }
.request-material .form.compact { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.request-material .item-actions { margin-top: 0; }
.compact-warning { border: 1px solid #E9D3A6; border-left: 3px solid #D29531; border-radius: 6px; background: #FFFAEF;
  padding: 10px 12px; margin: 12px 0 6px; color: #5C4319; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.compact-warning strong { display: block; color: #533911; font-size: 14px; font-weight: 650; }
.compact-warning > div { margin-top: 3px; }
.disabled-action:disabled { opacity: 1; background: #F5F5F4; border-color: #D8DBE0!important; color: #697386!important; font-weight: 600; }
.compact-results { margin-top: 12px; }
.compact-results .item { padding: 12px; }
.compact-results .item-actions { margin-top: 8px; }
.form-submit-bar { border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 14px 17px;
  display: flex; align-items: center; justify-content: space-between; gap: 15px; flex-wrap: wrap; }
.form-submit-bar p { margin: 0; }
.select-all { margin-bottom: 0; align-self: flex-start; }
.item-select { white-space: nowrap; }
.order-request-card .form.compact { margin-top: 8px; }
.order-qty-package, .order-qty-base { min-width: 0; }
.order-qty-package label, .order-qty-base label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.stock-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.stock-card-actions .btn { font-size: 12px; min-height: 35px; padding: 6px 10px; }
.production-leftover { margin: 14px 0; }
.group-section { margin-top: 30px; }
.top-actions { margin-top: 0; margin-bottom: 15px; }
@media (max-width: 767px) { .request-entry { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 540px) {
  .request-entry { grid-template-columns: 1fr; gap: 9px; }
  .item-title .tag { font-size: 11px; }
  .request-material .manual-request-form button { width: 100%; }
  .stock-card-actions .btn { flex: 1 1 auto; }
}

/* Owner clarity: restrained presentation, one selection controlling one view. */
.owner-picker {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; margin: 14px 0 17px; min-width: 0;
}
.owner-picker-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.eyebrow { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.owner-current { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0; color: var(--navy); font-size: 18px; }
.owner-current strong { font-size: 18px; font-weight: 650; }
.owner-kind { font-size: 12px; color: #50617A; background: #EAF0F6; padding: 3px 8px; border-radius: 5px; }
.owner-options { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.owner-option { display: inline-flex; min-height: 38px; align-items: center; justify-content: center;
  padding: 7px 13px; border: 1px solid var(--border); border-radius: 7px;
  background: #fff; color: var(--text); font-size: 13px; text-decoration: none;
  overflow-wrap: anywhere; }
.owner-option:hover { border-color: #9DB9E4; background: #F6F9FF; text-decoration: none; }
.owner-option.selected { color: var(--blue); border-color: var(--blue); background: var(--pale); font-weight: 650; }
.result-heading { display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap; margin: 20px 0 12px; }
.result-heading h2 { margin: 0; font-size: 18px; font-weight: 650; }
.result-heading p { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.material-card h3 { font-size: 17px; margin: 0; font-weight: 650; }
.material-meta { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.material-card .item-title { margin-bottom: 13px; }
.summary-facts { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,160px),1fr)); gap: 10px; margin: 13px 0; }
.summary-facts > div { display: grid; gap: 4px; min-width: 0; }
.summary-facts span, .summary-facts dt { font-size: 12px; color: var(--muted); font-weight: 400; }
.summary-facts strong, .summary-facts dd { margin: 0; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.item-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-top: 15px; }
.material-card .item-actions { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.material-info { grid-template-columns: repeat(auto-fit,minmax(min(100%,160px),1fr)); }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.card-subheading { font-size: 13px; font-weight: 650; color: var(--navy); margin: 16px 0 9px; }
.request-material .card-subheading { padding-top: 12px; border-top: 1px solid var(--border); }
.selected-owner-note { border-left: 3px solid var(--blue); padding: 8px 12px; background: #F6F9FF; font-size: 13px; }
.subsection { border-top: 1px solid var(--border); padding-top: 12px; }
.subsection h3 { margin: 0 0 4px; }
@media (max-width:540px) {
  .owner-picker { padding: 12px; margin: 12px 0; }
  .owner-current, .owner-current strong { font-size: 16px; }
  .owner-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .owner-option { font-size: 12px; padding: 8px; min-width: 0; }
  .item-actions .btn { flex: 1 1 auto; }
  .summary-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .card-subheading { margin-top: 12px; }
}
@media (max-width:340px) {
  .owner-options, .summary-facts { grid-template-columns: 1fr; }
}
.material-entry-fields { display: flex; flex-direction: column; gap: 15px; margin: 0; padding: 0; border: 0; min-width: 0; }
.material-entry-fields:disabled { opacity: .6; }

/* v0.3 final: a single owner selector and consistent actionable cards. */
.owner-picker { padding: 16px; }
.owner-picker-title { display: block; font-size: 17px; color: var(--navy); }
.owner-options {
  display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,210px),1fr));
  gap: 12px; align-items: stretch;
}
.owner-card {
  min-width: 0; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; padding: 14px; display: flex; flex-direction: column;
  gap: 5px;
}
.owner-card.is-current { border-color: #8AADE7; background: #F7FAFF; }
.owner-card-name { font-size: 16px; color: var(--navy); overflow-wrap: anywhere; }
.owner-card-action { align-self: stretch; margin-top: 9px; }
.material-lookup-card { display: flex; flex-direction: column; gap: 11px; }
.registration-status {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px 9px;
  border: 1px solid #C6D7F0; border-radius: 6px;
  padding: 9px 11px; background: #F0F5FF; color: #244E9D;
  font-size: 13px;
}
.registration-status.is-unregistered {
  border-color: #E9CF9F; background: #FFF7E8; color: #795214;
}
.registration-status > span:last-child { font-size: 12px; color: #516079; }
.registration-status.is-unregistered > span:last-child { color: #795214; }
.status-dot { width: 8px; height: 8px; background: #2B5CC4; border-radius: 50%; flex: 0 0 8px; }
.is-unregistered .status-dot { background: #CE9231; }
.material-lookup-heading h3 { margin: 0; font-size: 17px; color: var(--navy); }
.material-lookup-facts { margin: 0; grid-template-columns: repeat(auto-fit,minmax(min(100%,145px),1fr)); }
.material-lookup-card .item-actions { margin-top: 1px; padding-top: 12px; border-top: 1px solid var(--border); }
@media (max-width:540px) {
  .owner-options { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .owner-card { padding: 11px; }
  .owner-card-name { font-size: 14px; }
  .owner-card-action { font-size: 12px; padding: 8px 6px; }
}
@media (max-width:340px) { .owner-options { grid-template-columns: 1fr; } }

.owner-selected-note {
  display: flex; align-items: center; justify-content: center; min-height: 42px;
  padding: 8px 12px; margin-top: 9px; border: 1px solid #93B3E8;
  border-radius: 7px; color: #204B9D; background: #E7F0FF;
  font-size: 14px; font-weight: 700;
}
@media(max-width:540px) { .owner-selected-note { font-size: 12px; padding: 8px 6px; } }

/* v0.3 approval queue: calm layout, visible actions, no oversized alerts. */
.nav-counter { display: inline-flex; align-items:center; justify-content:center;
  min-width: 21px; height: 21px; padding: 0 5px; margin-left:auto;
  font-size: 11px; font-weight: 700; border-radius: 10px;
  background:#E7F0FF; color:#244D99; border:1px solid #BCD1F1; }
.review-actions { display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: 15px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.review-actions form { margin:0; min-width:0; }
.review-reject-form { display:flex; flex-wrap:wrap; align-items:end; gap:8px; }
.review-reject-form label { display:flex; flex-direction:column; gap:4px; font-size:12px; font-weight:600; }
.review-reject-form input { width:min(100%,280px); }
.review-history { padding-top: 8px; border-top: 1px solid var(--border); }
@media(max-width:540px) {
  .review-actions, .review-reject-form { display:grid; grid-template-columns:1fr; width:100%; }
  .review-actions button, .review-reject-form input { width:100%; }
  .nav-counter { margin-left:9px; }
}

/* v0.04: consistent desktop approval/rejection with comfortable separation. */
.review-actions { display:grid; grid-template-columns:minmax(160px, .65fr) minmax(320px, 1.8fr); align-items:start; column-gap:28px; row-gap:18px; }
.review-actions > form { min-width:0; padding:0; margin:0; }
.review-actions > form:first-child { padding-top:22px; }
.review-reject-form { display:grid; grid-template-columns:minmax(220px, 1fr) auto; gap:12px; align-items:end; }
.review-reject-form label { width:100%; }
.review-reject-form input { width:100%; max-width:none; }
.user-controls { display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
@media (max-width:767px) {
  .review-actions { grid-template-columns:1fr; row-gap:16px; }
  .review-actions > form:first-child { padding-top:0; }
  .review-reject-form { grid-template-columns:1fr; }
}

.variant-label {font-size:12px;color:#335680;margin-left:8px;overflow-wrap:anywhere;}

/* v0.4: reviewer enters an explicit quantity for unquantified requests. */
.review-actions.needs-quantity { grid-template-columns: minmax(260px,1fr) minmax(260px,1fr); }
.review-actions > form.review-approve-quantity { padding-top: 0; }
.review-quantity-fields { display: grid; gap: 9px; margin-bottom: 11px; }
.review-quantity-fields p { margin: 0 0 2px; }
.review-quantity-fields label { display:flex; flex-direction:column; gap: 4px; font-size:12px; font-weight:600; min-width:0; }
.review-quantity-fields input, .review-quantity-fields select { max-width: 100%; min-width:0; }
@media (max-width: 1050px) {
  .review-actions.needs-quantity { grid-template-columns:1fr; }
}


/* Replenishment review: selection stays visible while reviewing requests. */
.approval-bulk-bar {
  position: sticky; top: 10px; z-index: 5; margin: 12px 0 16px;
  border-color: #BECDE0; background: #F7FAFF;
  box-shadow: 0 3px 10px rgba(25, 48, 80, .07);
}
.approval-bulk-explanation { display: grid; gap: 6px; flex: 1 1 360px; min-width: 0; }
.approval-bulk-explanation p { margin: 0; }
.approval-bulk-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 2px; }
.approval-select-all, .review-bulk-selection { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; font-weight: 650; }
.approval-select-all input, .review-bulk-selection input { width: 18px; height: 18px; margin: 0; accent-color: #205EA6; flex-shrink: 0; }
.approval-bulk-bar > button { flex: 0 0 auto; }
.approval-bulk-bar button:disabled { opacity: .55; cursor: not-allowed; }
.review-identity-line { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 13px; min-width: 0; }
.review-bulk-selection { padding: 7px 9px; border-radius: 6px; border: 1px solid #CCD7E5; background: #F7FAFF; }
.review-bulk-selection:has(input:checked) { border-color: #8FB2E2; background: #E9F2FF; }
.review-bulk-selection:has(input:disabled) { color: #788393; opacity: .68; cursor: not-allowed; }
.review-material-link { display: inline-block; margin-top: 5px; }
.review-bulk-quantity-note { margin: 10px 0 0; color: #4C627E; }
/* Nearby requests are shown explicitly, separating unreviewed and approved ones. */
.review-related-heading { border-top: 2px solid #B6CAE6; padding: 12px 4px 2px; margin-top: 7px; }
.review-related-heading strong { color: #234E84; font-size: 15px; }
.review-related-heading p { margin: 3px 0 0; }
.review-related-candidates { border: 1px solid #C7D7EB; border-left: 3px solid #557EBA;
  border-radius: 7px; padding: 12px 14px; background: #F4F8FF; font-size: 13px; min-width: 0; }
.review-related-candidates > strong { font-size: 14px; color: #254F82; }
.review-related-candidates > p { margin: 4px 0 10px; }
.review-related-candidate-list { display: grid; gap: 8px; margin: 9px 0; }
.review-related-candidate { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 13px;
  background: #fff; border: 1px solid #D9E3F0; border-radius: 6px; padding: 9px 11px;
  overflow-wrap: anywhere; min-width: 0; }
.review-related-candidate > strong { white-space: nowrap; }
.review-related-reason { flex-basis: 100%; }
.review-card:has(.review-bulk-choice:checked) { border-color: #8FB2E2; }
@media (max-width: 767px) {
  .approval-bulk-bar { position: static; }
  .approval-bulk-bar > button { flex: 1 1 100%; }
  .review-identity-line { gap: 9px; }
}

/* v0.05: two uncomplicated administrative workspaces.
 * Order PDFs and supplier communication live on 発注管理;
 * all waiting order lines are receivable on one 入庫管理 screen.
 */
.order-workflow-panel { margin-top: 18px; }
.order-workflow-panel h2, .result-heading h2 { margin-bottom: 3px; }
.order-list, .receipt-list { display: grid; gap: 10px; margin: 13px 0 20px; }
.order-list-item { padding: 17px 19px; }
.order-list-main { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.order-list-main h3 { margin: 3px 0; font-size: 17px; }
.order-list-actions { margin-top: 14px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.order-list-actions form { margin: 0; }
.order-archive { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 14px; }
.order-archive summary { color: var(--muted); font-size: 13px; cursor: pointer; }
.order-history-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.receipt-item { padding: 17px 19px; }
.receipt-header { margin-bottom: 12px; }
.receipt-quantities { display: flex; flex-wrap: wrap; gap: 9px 24px; border-top: 1px solid var(--border); padding-top: 10px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.receipt-quantities strong { color: var(--navy); margin-left: 4px; }
.receipt-entry-fields { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.receipt-entry-fields label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.receipt-submit { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; }
.receipt-submit > .small { margin-right: auto; }
.receipt-entry-form input, .receipt-entry-form select { min-width: 0; }
@media (max-width: 1100px) { .receipt-entry-fields { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 540px) {
  .receipt-entry-fields { grid-template-columns: 1fr; }
  .order-list-item,.receipt-item { padding: 13px; }
  .receipt-submit .btn { width: 100%; }
  .order-list-actions .btn,.order-list-actions form { width: 100%; }
  .order-list-actions form .btn { width: 100%; }
}
