:root {
    /* ライトテーマ（白ベース） */
    --bg: #f4f6f9;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #475569;
    --accent: #2563eb;
    --accent-dim: rgba(37, 99, 235, 0.12);
    --accent-border: rgba(37, 99, 235, 0.35);
    --accent-hi: #1d4ed8;
    --sidebar-ink: #334155;
    --sidebar-muted: #475569;
    --input-bg: #ffffff;
    --ok: #16a34a;
    --warn: #ca8a04;
    --danger: #dc2626;

    /* Liquid Glass (iOS 26) — đổi --glass-tint-rgb để thử màu:
       xanh iOS:  0, 122, 255
       xanh lá:   45, 138, 62
       tím:       88, 86, 214
       cam:       255, 149, 0
       hồng:      255, 45, 85
       trắng:     255, 255, 255 */
    --glass-blur: blur(32px) saturate(185%);
    --glass-blur-soft: blur(18px) saturate(165%);
    --glass-tint-rgb: 0, 122, 255;
    --glass-surface: rgba(255, 255, 255, 0.52);
    --glass-border: rgba(255, 255, 255, 0.78);
    --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.88);
    --glass-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    --nav-glass-hover-bg: rgba(var(--glass-tint-rgb), 0.22);
    --nav-glass-hover-border: rgba(var(--glass-tint-rgb), 0.38);
    --nav-glass-hover-text: #1e3a8a;
    --nav-glass-hover-shadow: inset 0 1px 0 rgba(var(--glass-tint-rgb), 0.14), 0 3px 12px rgba(var(--glass-tint-rgb), 0.14);
    --nav-glass-active-bg: rgba(var(--glass-tint-rgb), 0.3);
    --nav-glass-active-border: rgba(var(--glass-tint-rgb), 0.45);
    --nav-glass-active-text: #1e3a8a;
    --nav-glass-active-shadow: inset 0 1px 0 rgba(var(--glass-tint-rgb), 0.18), 0 4px 16px rgba(var(--glass-tint-rgb), 0.16);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--accent-hi); text-decoration: none; }

/* レイアウト：左サイドバー＝単一の枠（1色面）+ メイン */
.app-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
    background:
        radial-gradient(ellipse 80% 55% at 0% 0%, rgba(186, 210, 255, 0.38), transparent 55%),
        radial-gradient(ellipse 65% 50% at 100% 100%, rgba(210, 225, 255, 0.28), transparent 52%),
        linear-gradient(168deg, #e8edf4 0%, #f3f6fb 50%, #eef2f8 100%);
}
.app-sidebar {
    --sidebar-surface: var(--glass-surface);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    align-self: flex-start;
    position: sticky;
    top: 0;
    z-index: 30;
    width: 16.25rem;
    max-height: 100vh;
    box-sizing: border-box;
    padding: 1rem 0.45rem 1rem 0.75rem;
    background: var(--sidebar-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 0.5px solid var(--glass-border);
    border-left: none;
    border-radius: 0 1.35rem 1.35rem 0;
    box-shadow:
        var(--glass-shadow),
        var(--glass-highlight);
    overflow-x: visible;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.app-sidebar__collapse-btn,
.app-sidebar__expand-tab {
    display: none;
}
.app-sidebar__collapse-btn {
    position: absolute;
    top: 0.7rem;
    right: 0.35rem;
    z-index: 3;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.45);
    color: #64748b;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    box-shadow: none;
}
.app-sidebar__collapse-btn:hover {
    color: var(--text);
    border-color: rgba(15, 23, 42, 0.22);
    background: rgba(255, 255, 255, 0.82);
}
.app-sidebar__collapse-btn svg {
    width: 1.125rem;
    height: 1.125rem;
}
.app-sidebar__expand-tab {
    position: fixed;
    left: 0;
    top: 0.7rem;
    z-index: 35;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-left: none;
    border-radius: 0 6px 6px 0;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: var(--glass-blur-soft);
    -webkit-backdrop-filter: var(--glass-blur-soft);
    color: #64748b;
    cursor: pointer;
    box-shadow: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.app-sidebar__expand-tab:hover {
    color: var(--text);
    border-color: rgba(15, 23, 42, 0.22);
    background: rgba(255, 255, 255, 0.82);
}
.app-sidebar__expand-tab svg {
    width: 1.125rem;
    height: 1.125rem;
}
@media (min-width: 721px) {
    .app-sidebar {
        padding-right: 2.35rem;
        transition:
            width 0.24s ease,
            opacity 0.2s ease,
            transform 0.24s ease,
            padding 0.24s ease,
            border-color 0.2s ease;
    }
    .app-sidebar__collapse-btn {
        display: inline-flex;
    }
    body.app-sidebar-collapsed .app-sidebar {
        width: 0;
        min-width: 0;
        padding-left: 0;
        padding-right: 0;
        opacity: 0;
        transform: translateX(-100%);
        border-color: transparent;
        pointer-events: none;
        overflow: hidden;
    }
    body.app-sidebar-collapsed .app-sidebar__expand-tab:not([hidden]) {
        display: inline-flex;
    }
}
.app-sidebar__block {
    display: flex;
    flex-direction: column;
    /* primary と secondary で shrink が違うと、狭いビューで primary が潰れてメニューが重なる */
    flex-shrink: 0;
    min-height: auto;
}
/* 中身は同じ枠内：背景・枠線なし */
.app-sidebar__block--primary {
    position: relative;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
}
.app-sidebar__block--secondary {
    flex: 0 0 auto;
    position: relative;
    margin: 0.7rem 0 0;
    padding: 0.65rem 0 0;
    background: none;
    border: none;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
}
.app-sidebar__footer {
    flex-shrink: 0;
    margin-top: 0.65rem;
    padding: 0.75rem 0.15rem 0.15rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.app-sidebar__user-line {
    margin: 0 0 0.45rem;
    padding: 0 0.2rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--sidebar-muted);
}
.app-sidebar__user-label {
    display: block;
    word-break: break-word;
}
.app-sidebar__logout-form {
    margin: 0;
}
.app-sidebar__logout-btn {
    width: 100%;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.75rem 0.65rem;
    font-size: 0.85rem;
    text-decoration: none;
    box-sizing: border-box;
}
.app-sidebar__brand,
.app-sidebar__nav {
    position: relative;
}
.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: inherit;
    text-decoration: none;
    min-width: 0;
    margin: 0 0 0.9rem;
    padding: 0 0 0.85rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.app-sidebar__brand:hover { color: var(--text); }
.app-sidebar__guest-banner {
    margin: 0 0 0.75rem;
    padding: 0 0 0.75rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.app-sidebar__guest-login-btn {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
    text-decoration: none;
    gap: 0.45rem;
}
.app-sidebar__block--primary .app-brand__mark {
    min-height: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    max-width: 8.5rem;
    width: auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: none;
}
.app-sidebar__block--primary .app-brand__mark .app-brand__logo {
    display: block;
    max-width: 100%;
    max-height: 2.35rem;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: left center;
    background: transparent;
    filter: none;
}
.app-sidebar__block--primary .app-brand__title { color: var(--text); }
.app-sidebar__block--primary .app-brand__sub { color: var(--sidebar-muted); }
.app-brand__text { min-width: 0; }
.app-brand__title { display: block; font-size: 0.88rem; font-weight: 800; letter-spacing: 0.02em; line-height: 1.3; word-break: keep-all; }
.app-brand__title-ja { display: block; margin-top: 0.08rem; letter-spacing: 0.06em; }
.app-brand__sub { display: block; font-size: 0.7rem; font-weight: 500; margin-top: 0.1rem; letter-spacing: 0.02em; }
.app-sidebar__nav {
    --nav-hover-bg: var(--nav-glass-hover-bg);
    --nav-hover-border: var(--nav-glass-hover-border);
    --nav-hover-text: var(--nav-glass-hover-text);
    --nav-hover-shadow: var(--nav-glass-hover-shadow);
    --nav-active-bg: var(--nav-glass-active-bg);
    --nav-active-border: var(--nav-glass-active-border);
    --nav-active-text: var(--nav-glass-active-text);
    --nav-active-shadow: var(--nav-glass-active-shadow);
    /* リンクと button トグルで同一サイズ（button の font: inherit で body 系になっていた） */
    --sidebar-nav-font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}
.app-nav__link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.52rem 0.6rem 0.52rem 0.5rem;
    border-radius: 0 0.85rem 0.85rem 0;
    font-size: var(--sidebar-nav-font-size);
    font-weight: 600;
    color: var(--sidebar-ink);
    background: transparent;
    border: 0.5px solid transparent;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.app-nav__link:hover {
    background: var(--nav-hover-bg);
    backdrop-filter: var(--glass-blur-soft);
    -webkit-backdrop-filter: var(--glass-blur-soft);
    color: var(--nav-hover-text);
    border-color: var(--nav-hover-border);
    box-shadow: var(--nav-hover-shadow);
}
.app-nav__link.is-active {
    background: var(--nav-active-bg);
    backdrop-filter: var(--glass-blur-soft);
    -webkit-backdrop-filter: var(--glass-blur-soft);
    color: var(--nav-active-text);
    font-weight: 700;
    border-color: var(--nav-active-border);
    box-shadow: var(--nav-active-shadow);
    margin-right: -0.1rem;
}
.app-nav__link.is-active:hover {
    background: rgba(var(--glass-tint-rgb), 0.36);
    color: #172554;
    border-color: rgba(var(--glass-tint-rgb), 0.5);
}
.app-nav__link:focus-visible {
    outline: 2px solid var(--accent-border);
    outline-offset: 1px;
}
.app-nav__link svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    stroke: currentColor;
    opacity: 0.9;
}
.app-nav__badge {
    margin-left: auto;
    min-width: 1.25rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
}
.app-nav__badge-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.18rem;
    margin-left: auto;
}
.app-nav__badge--supervisor {
    background: #2563eb;
}
.app-nav__badge--sales-supervisor {
    background: #d97706;
}
.app-nav__badge--general-affairs {
    background: #7c3aed;
}
.app-nav__badge--accounting {
    background: #0f766e;
}
.app-nav__group--nested {
    gap: 0.08rem;
}

.app-nav__toggle--nested {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.38rem 0.55rem 0.38rem 0.45rem;
    border-radius: 0 0.65rem 0.65rem 0;
    font-size: var(--sidebar-nav-font-size);
    font-weight: 600;
    color: var(--sidebar-ink);
    background: transparent;
    border: 0.5px solid transparent;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.app-nav__toggle--nested:hover {
    background: var(--nav-hover-bg);
    backdrop-filter: var(--glass-blur-soft);
    -webkit-backdrop-filter: var(--glass-blur-soft);
    color: var(--nav-hover-text);
    border-color: var(--nav-hover-border);
    box-shadow: var(--nav-hover-shadow);
}

.app-nav__toggle--nested.is-active {
    background: var(--nav-active-bg);
    backdrop-filter: var(--glass-blur-soft);
    -webkit-backdrop-filter: var(--glass-blur-soft);
    color: var(--nav-active-text);
    font-weight: 700;
    border-color: var(--nav-active-border);
    box-shadow: var(--nav-active-shadow);
}

.app-nav__subs--nested {
    margin-left: 0.35rem;
    padding-left: 0.3rem;
    border-left-color: rgba(var(--glass-tint-rgb), 0.22);
}

.app-nav__link.is-active svg { opacity: 1; }
.app-nav__group {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}
button.app-nav__toggle {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    width: 100%;
    color: inherit;
    font-family: inherit;
    font-size: var(--sidebar-nav-font-size);
    font-weight: 600;
    line-height: inherit;
    text-align: left;
}
.app-nav__toggle .app-nav__toggle-text {
    flex: 1;
    min-width: 0;
    text-align: left;
    font-size: inherit;
}
.app-nav__chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-left: 0.15rem;
    opacity: 0.72;
    transition: transform 0.18s ease, opacity 0.15s ease;
}
.app-nav__group.is-open .app-nav__chevron {
    transform: rotate(180deg);
    opacity: 0.95;
}
.app-nav__subs {
    display: none;
    flex-direction: column;
    gap: 0.08rem;
    padding: 0 0 0.12rem 0.35rem;
    margin: 0 0 0 0.4rem;
    border-left: 2px solid rgba(var(--glass-tint-rgb), 0.24);
}
.app-nav__subheading {
    display: block;
    margin: 0.45rem 0 0.15rem 0.45rem;
    padding: 0;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sidebar-muted);
}
.app-nav__subheading:first-child {
    margin-top: 0.1rem;
}
#nav-expiry-alerts-subs .expiry-nav-section-heading,
.expiry-nav-section-heading {
    display: block;
    margin: 0.5rem 0.2rem 0.2rem 0;
    padding: 0.4rem 0.6rem;
    border-radius: 0.55rem;
    background: rgba(var(--glass-tint-rgb), 0.12);
    backdrop-filter: var(--glass-blur-soft);
    -webkit-backdrop-filter: var(--glass-blur-soft);
    color: #1d4ed8;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: none;
    border: 0.5px solid rgba(var(--glass-tint-rgb), 0.24);
    box-shadow: var(--glass-highlight);
    line-height: 1.35;
}
#nav-expiry-alerts-subs .expiry-nav-section-heading:first-child {
    margin-top: 0.15rem;
}
.app-nav__group.is-open .app-nav__subs {
    display: flex;
}
.app-nav__sublink {
    display: block;
    padding: 0.38rem 0.55rem 0.38rem 0.45rem;
    border-radius: 0 0.65rem 0.65rem 0;
    font-size: var(--sidebar-nav-font-size);
    font-weight: 600;
    color: var(--sidebar-ink);
    background: transparent;
    border: 0.5px solid transparent;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.app-nav__sublink:hover {
    background: var(--nav-hover-bg);
    backdrop-filter: var(--glass-blur-soft);
    -webkit-backdrop-filter: var(--glass-blur-soft);
    color: var(--nav-hover-text);
    border-color: var(--nav-hover-border);
    box-shadow: var(--nav-hover-shadow);
}
.app-nav__sublink.is-active {
    background: var(--nav-active-bg);
    backdrop-filter: var(--glass-blur-soft);
    -webkit-backdrop-filter: var(--glass-blur-soft);
    color: var(--nav-active-text);
    font-weight: 700;
    border-color: var(--nav-active-border);
    box-shadow: var(--nav-active-shadow);
}
.app-nav__sublink.is-active:hover {
    background: rgba(var(--glass-tint-rgb), 0.36);
    color: #172554;
    border-color: rgba(var(--glass-tint-rgb), 0.5);
}
.app-nav__sublink:focus-visible {
    outline: 2px solid var(--accent-border);
    outline-offset: 1px;
}
.bp-suite-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.35rem;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid rgba(37, 99, 235, 0.35);
    color: var(--accent);
    vertical-align: middle;
}
.bp-suite-badge--ec {
    border-color: rgba(100, 116, 139, 0.45);
    color: var(--muted);
}
.app-main {
    flex: 1;
    min-width: 0;
    background: var(--bg);
}
.app-main__inner,
.wrap {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 1rem 1.15rem 1.5rem;
}
.flash { padding: 0.65rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.flash--warning { background: #ffedd5; color: #9a3412; border-color: #fdba74; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.35rem; }
input, textarea, select { width: 100%; padding: 0.55rem 0.65rem; border-radius: 8px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.row { display: grid; gap: 1rem; }
@media (min-width: 560px) { .row-2 { grid-template-columns: 1fr 1fr; } }
/* 商品詳細：左に項目グリッド、右に商品画像（空きエリア） */
.product-show-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem 1.5rem;
}
.product-show-summary__dl {
    flex: 1 1 16rem;
    min-width: 0;
}
.product-show-summary__media {
    flex: 0 1 20rem;
    max-width: 100%;
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: flex-start;
    justify-content: flex-end;
}
.product-show-summary__media-main {
    flex: 0 0 auto;
}
.product-show-summary__media-main img {
    max-width: min(100%, 280px);
    max-height: 220px;
    border-radius: 10px;
    border: 1px solid var(--border);
    object-fit: contain;
    display: block;
}
.product-show-summary__media-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}
.product-show-summary__media-gallery img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    border: 1px solid var(--border);
    object-fit: cover;
    display: block;
}
@media (max-width: 640px) {
    .product-show-summary__media {
        margin-left: 0;
        justify-content: flex-start;
    }
}
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.55rem 1rem; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; font-size: 0.95rem; }
.btn-sm { padding: 0.4rem 0.65rem; font-size: 0.85rem; }
/* トップナビの is-active と同系の「青枠＋淡い青背景」 */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent-hi);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover {
    background: var(--accent-hi);
    color: #fff;
    border-color: #1e40af;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.btn-primary:focus-visible {
    outline: 2px solid var(--accent-hi);
    outline-offset: 2px;
}
.btn-ghost { background: #f8fafc; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); color: #052e16; }
.btn-warn { background: var(--warn); color: #1a1404; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); font-size: 0.9rem; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.products-search-row {
    display: grid;
    grid-template-columns: auto minmax(16rem, 1fr) auto;
    align-items: end;
    gap: 0.85rem 1rem;
    margin-bottom: 1rem;
}
.products-search-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    max-width: 100%;
}
.products-search-main {
    min-width: 0;
}
.products-search-main label {
    margin-bottom: 0.25rem;
}
.products-search-main input[type="search"] {
    width: 100%;
    min-width: 0;
}
.products-search-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    justify-content: flex-end;
}
.products-search-actions .btn,
.products-search-links .btn {
    white-space: nowrap;
}
.products-table th,
.products-table td {
    vertical-align: middle;
}
.products-table__name-col {
    min-width: 13rem;
}
.products-table__check-col {
    width: 2.75rem;
    text-align: center;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}
.products-table__check-col input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    vertical-align: middle;
    cursor: pointer;
}
.products-table td.actions {
    white-space: nowrap;
}
@media (max-width: 980px) {
    .products-search-row {
        grid-template-columns: 1fr 1fr;
    }
    .products-search-main {
        grid-column: 1 / -1;
        order: -1;
    }
    .products-search-actions {
        justify-content: flex-start;
    }
}
@media (max-width: 640px) {
    .products-search-row {
        grid-template-columns: 1fr;
    }
    .products-search-links,
    .products-search-actions {
        justify-content: flex-start;
    }
    .products-search-actions .btn,
    .products-search-links .btn {
        flex: 1 1 auto;
    }
}
.products-toolbar-row {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.products-toolbar-meta {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem 1.25rem;
    flex-shrink: 0;
}
.per-page-form { flex-shrink: 0; }
.product-count-total {
    margin: 0;
    padding-bottom: 0.15rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.purchase-products-hidden-box {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.35rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid rgba(180, 83, 9, 0.28);
    border-radius: 8px;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.purchase-products-hidden-box:hover {
    border-color: rgba(180, 83, 9, 0.45);
    background: #fef3c7;
    color: #78350f;
}
.purchase-products-hidden-box.is-active {
    border-color: #b45309;
    background: #b45309;
    color: #fff;
}
.purchase-products-hidden-box__count {
    font-variant-numeric: tabular-nums;
}
.purchase-products-toolbar--hidden-view {
    border-radius: 10px;
    padding: 0.35rem 0.15rem;
}
.purchase-products-table__hidden-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    background: #fffbeb;
    border: 1px solid rgba(180, 83, 9, 0.25);
    color: #b45309;
    font-size: 0.68rem;
    font-weight: 700;
    vertical-align: middle;
}
.purchase-products-table__provisional-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    background: #e8f1ff;
    border: 1px solid rgba(29, 79, 145, 0.28);
    color: #1d4f91;
    font-size: 0.68rem;
    font-weight: 700;
    vertical-align: middle;
}
.per-page-field { min-width: 7.5rem; }
.per-page-field label {
    margin-bottom: 0.35rem;
}
select.select-per-page {
    width: 100%;
    min-width: 7.25rem;
    max-width: 11rem;
    padding: 0.45rem 2rem 0.45rem 0.65rem;
    border-radius: 10px;
    border: 1px solid var(--accent-border);
    background-color: var(--input-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.45rem center;
    background-size: 1rem 1rem;
    appearance: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}
select.select-per-page:hover {
    border-color: rgba(37, 99, 235, 0.45);
}
select.select-per-page:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
select.select-per-page option {
    background: var(--card);
    color: var(--text);
}
.error { color: #b91c1c; font-size: 0.9rem; margin-top: 0.25rem; }
.inventory-errors { border-color: #fecaca; background: #fef2f2; }
.inventory-errors ul { margin: 0; padding-left: 1.2rem; color: #991b1b; }

.inv-text-nowrap {
    white-space: nowrap;
}

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

/* 商品追加 — CSV 1行ツールバー（最小所占） */
.card.product-io-card {
    padding: 0.38rem 0.55rem;
    margin-bottom: 0.6rem;
}
.product-io-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem 0.45rem;
}
.product-io-brand {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--muted);
    letter-spacing: 0.1em;
}
.product-io-divider {
    width: 1px;
    align-self: stretch;
    min-height: 1.15rem;
    background: var(--border);
    opacity: 0.55;
}
.product-io-toolbar-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
}
.product-io-file-inline {
    font-size: 0.72rem !important;
    padding: 0.22rem 0.35rem !important;
    max-width: min(200px, 46vw);
}
.product-io-btn {
    padding: 0.32rem 0.55rem !important;
    font-size: 0.76rem !important;
}
.product-io-btn--compact {
    padding: 0.28rem 0.48rem !important;
    font-size: 0.72rem !important;
    line-height: 1.2;
}
.product-io-upload-trigger {
    margin: 0;
    cursor: pointer;
}
.product-io-error {
    margin: 0.35rem 0 0 !important;
    font-size: 0.76rem !important;
}

/* 商品画像 fieldset（products/partials/product-images-fieldset） */
.product-images-fieldset__lead {
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
}
.product-images-fieldset .error {
    margin: 0.35rem 0 0;
}

/* 商品追加：KiotViet 風（左メイン大＋右に縦4サムネ） */
.product-images-uploader {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.5rem 0.6rem;
    margin-bottom: 0.25rem;
    width: fit-content;
    max-width: 100%;
}
.product-images-main {
    flex: 0 0 auto;
    width: 11rem;
    min-width: 9.5rem;
    max-width: min(11rem, 52vw);
    display: flex;
}
.product-images-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    flex: 1;
    width: 100%;
    min-height: 15.25rem;
    padding: 0.65rem 0.55rem;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.product-images-drop:hover {
    border-color: rgba(147, 197, 253, 0.55);
    background: rgba(59, 130, 246, 0.08);
}
.product-images-drop:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.product-images-btn {
    display: inline-block;
    padding: 0.42rem 0.95rem;
    border-radius: 6px;
    border: 1px solid #94a3b8;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    color: #1e293b;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.product-images-btn:hover {
    background: linear-gradient(180deg, #fff 0%, #f1f5f9 100%);
}
.product-images-hint-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.12rem;
    max-width: 9.5rem;
}
.product-images-hint {
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--muted);
}
.product-images-hint-sub {
    font-size: 0.62rem;
    line-height: 1.3;
    color: var(--muted);
    opacity: 0.9;
}
.product-images-preview {
    max-width: 100%;
    max-height: 10rem;
    border-radius: 6px;
    object-fit: contain;
}
.product-images-drop.has-photo .product-images-btn,
.product-images-drop.has-photo .product-images-hint-wrap {
    display: none;
}
.product-images-thumbs {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 0.4rem;
    flex-shrink: 0;
    align-self: stretch;
    padding: 0.05rem 0;
}
.product-images-thumb {
    position: relative;
    width: 3.5rem;
    height: 3.5rem;
    flex: 0 0 auto;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: border-color 0.15s, background 0.15s;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.product-images-thumb:hover {
    border-color: rgba(147, 197, 253, 0.5);
    background: rgba(59, 130, 246, 0.07);
}
.product-images-thumb:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.product-images-thumb svg {
    width: 20px;
    height: 20px;
    opacity: 0.42;
    color: var(--muted);
}
.product-images-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.product-images-thumb img.is-hidden {
    display: none;
}
.product-images-thumb .thumb-ph {
    pointer-events: none;
}
.product-images-thumb.has-photo .thumb-ph {
    display: none;
}

/* 商品追加フォーム：左フィールド / 右画像（KiotViet 風） */
.product-create-form-kiot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem 1.15rem;
    align-items: start;
}
.product-create-form-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.product-create-form-main > .row,
.product-create-form-main > div {
    width: 100%;
}
.product-create-form-media {
    position: sticky;
    top: 0.75rem;
    align-self: start;
    padding-top: 0.15rem;
}
.product-create-form-actions {
    grid-column: 1 / -1;
    margin-top: 0.25rem;
}
/* モバイル：コンパクトヘッダー＋ドロワーメニュー */
.app-mobile-topbar,
.app-mobile-scrim,
.app-sidebar__mobile-close {
    display: none;
}
.app-mobile-topbar__menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.app-mobile-topbar__menu svg {
    width: 1.25rem;
    height: 1.25rem;
}
.app-mobile-topbar__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}
.app-mobile-topbar__logo {
    width: 1.75rem;
    height: 1.75rem;
    object-fit: contain;
    flex-shrink: 0;
}
.app-mobile-topbar__title {
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-sidebar__mobile-close {
    position: absolute;
    top: 0.55rem;
    right: 0.45rem;
    z-index: 2;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

/* 720px 以下：アプリ風ドロワーナビ */
@media (max-width: 720px) {
    .app-mobile-topbar {
        display: flex;
        align-items: center;
        gap: 0.55rem;
        position: sticky;
        top: 0;
        z-index: 50;
        padding: 0.5rem 0.65rem;
        padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
        background: var(--card);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 1px 10px rgba(15, 23, 42, 0.06);
    }
    .app-mobile-scrim:not([hidden]) {
        display: block;
    }
    .app-sidebar__mobile-close {
        display: block;
    }
    .app-mobile-scrim {
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(15, 23, 42, 0.42);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }
    .app-mobile-scrim[hidden] {
        display: none !important;
    }
    body.app-mobile-nav-open {
        overflow: hidden;
    }
    .app-main__inner,
    .wrap {
        padding: 0.65rem 0.72rem 1.2rem;
        padding-bottom: max(1.2rem, env(safe-area-inset-bottom, 0px));
    }
    .app-shell {
        flex-direction: column;
        min-height: 100vh;
        min-height: 100dvh;
        width: 100%;
        max-width: 100%;
    }
    /* overflow-x を中間コンテナに付けると縦スクロールバーが二重・白く太くなるため、html のみ clip */
    html {
        overflow-x: clip;
        max-width: 100%;
    }
    body {
        max-width: 100%;
        width: 100%;
        overscroll-behavior-x: none;
    }
    .app-main {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .app-sidebar {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 60;
        width: min(18.5rem, 88vw);
        max-height: none;
        height: 100%;
        height: 100dvh;
        margin: 0;
        padding: 2.35rem 0.45rem 1rem 0.75rem;
        padding-top: max(2.35rem, calc(env(safe-area-inset-top, 0px) + 1.75rem));
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
        border-radius: 0 1rem 1rem 0;
        border: 1px solid var(--border);
        border-left: none;
        /* 画面外に置かず、閉じ時は幅0にして横スクロール幅を増やさない */
        transform: none;
        translate: none;
        transition:
            width 0.26s ease,
            padding 0.26s ease,
            border-color 0.2s ease,
            visibility 0.26s ease;
        width: 0;
        max-width: 0;
        padding-left: 0;
        padding-right: 0;
        border-color: transparent;
        visibility: hidden;
        pointer-events: none;
        overflow-x: hidden;
        overflow-y: auto;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        align-self: auto;
        -webkit-overflow-scrolling: touch;
    }
    body.app-mobile-nav-open .app-sidebar,
    .app-sidebar.is-mobile-open {
        width: min(18.5rem, 88vw);
        max-width: min(18.5rem, 88vw);
        padding: 2.35rem 0.45rem 1rem 0.75rem;
        padding-top: max(2.35rem, calc(env(safe-area-inset-top, 0px) + 1.75rem));
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
        border-color: var(--border);
        visibility: visible;
        pointer-events: auto;
        box-shadow: 8px 0 36px rgba(15, 23, 42, 0.2);
    }
    .app-sidebar__block--primary,
    .app-sidebar__block--secondary {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        flex: 0 0 auto;
        min-height: auto;
        border-radius: 0;
        background: none !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0;
        overflow: visible;
    }
    .app-sidebar__block--primary {
        padding-right: 0;
        border-right: none;
    }
    .app-sidebar__block--secondary {
        margin: 0.7rem 0 0;
        padding: 0.65rem 0 0;
        border-top: 1px solid rgba(15, 23, 42, 0.08);
    }
    .app-sidebar__guest-banner {
        margin: 0 0 0.75rem;
        padding: 0 0 0.75rem;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
        flex-shrink: 0;
        align-self: stretch;
    }
    .app-sidebar__guest-login-btn {
        width: 100%;
        padding: 0.55rem 0.75rem;
        font-size: 0.85rem;
        white-space: normal;
    }
    .app-sidebar__brand {
        margin: 0 0 0.9rem;
        padding: 0 0 0.85rem;
        padding-right: 2rem;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
        max-width: none;
    }
    .app-sidebar__block--primary .app-brand__title {
        font-size: 0.88rem;
        line-height: 1.3;
    }
    .app-sidebar__block--primary .app-brand__mark {
        min-height: 2.5rem;
        height: 2.5rem;
        min-width: 2.5rem;
        max-width: 8.5rem;
        padding: 0.2rem 0.35rem;
    }
    .app-sidebar__block--primary .app-brand__mark .app-brand__logo {
        max-height: 2.1rem;
    }
    .app-sidebar__nav {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0.18rem;
        --sidebar-nav-font-size: 0.85rem;
    }
    .app-nav__link {
        padding: 0.62rem 0.65rem 0.62rem 0.55rem;
        border-radius: 0 0.7rem 0.7rem 0;
        margin-right: 0;
        white-space: normal;
        min-height: 2.75rem;
    }
    .app-nav__link svg {
        width: 17px;
        height: 17px;
    }
    .app-nav__group {
        position: static;
    }
    .app-nav__group .app-nav__subs {
        position: static;
        top: auto;
        left: auto;
        min-width: 0;
        padding: 0 0 0.12rem 0.35rem;
        margin: 0 0 0 0.4rem;
        border-left: 2px solid rgba(var(--glass-tint-rgb), 0.24);
        background: none;
        border-top: none;
        border-right: none;
        border-bottom: none;
        border-radius: 0;
        box-shadow: none;
    }
    .app-nav__group.is-open .app-nav__subs {
        display: flex;
    }
    .app-nav__sublink {
        min-height: 2.5rem;
        display: flex;
        align-items: center;
        padding-top: 0.45rem;
        padding-bottom: 0.45rem;
    }
    .app-sidebar__footer {
        margin-top: auto;
        padding-top: 0.75rem;
    }
    .card {
        padding: 0.95rem 0.8rem;
        border-radius: 10px;
        margin-bottom: 0.85rem;
    }
    .product-create-form-kiot {
        grid-template-columns: 1fr;
    }
    .product-create-form-media {
        position: static;
        justify-self: start;
    }
}

/* —— 共通：Blade のインライン style を class に寄せる —— */
.inv-h1 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
}
.inv-h1--sm {
    font-size: 1.1rem;
}
.inv-h1--md {
    font-size: 1.15rem;
}
.inv-h2--create {
    margin: 0 0 1rem;
    font-size: 1.05rem;
}
.inv-h2--section {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}
.inv-h2--lots {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}
.inv-page-lead {
    margin: 0 0 1.25rem;
}
.inv-muted-below {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
}
.inv-actions-top {
    display: flex;
    margin-bottom: 1rem;
    justify-content: space-between;
    align-items: flex-start;
}
.inv-actions-top--search {
    margin-bottom: 1rem;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.inv-page-header {
    display: flex;
    margin-bottom: 1rem;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}
.inv-page-header--v-start {
    align-items: flex-start;
}
.inv-title-tight {
    margin: 0;
    font-size: 1.1rem;
}
.inv-h1-name {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
}
.inv-product-title {
    margin: 0;
    font-size: 1.25rem;
}
.inv-m-0 {
    margin: 0;
}
.inv-note-pre {
    margin: 0 0 1rem;
    white-space: pre-wrap;
}
.table-scroll {
    overflow-x: auto;
}
.customer-master-code {
    font-size: 0.82rem;
}
.customer-master-addr {
    max-width: 20rem;
    font-size: 0.82rem;
    line-height: 1.45;
    vertical-align: top;
}
.inv-text-right {
    text-align: right;
}
.inv-payments-filter {
    align-items: end;
    margin-bottom: 1rem;
}
.inv-payments-filter-actions {
    padding-top: 1.2rem;
}
.payments-table-wrap {
    max-height: min(70vh, 52rem);
    overflow: auto;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.payments-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
    background: var(--card, #fff);
    box-shadow: inset 0 -1px 0 var(--border);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #475569;
}
.dl-flush {
    margin: 0;
}
.product-show-summary__dl dd,
.inv-dd {
    margin: 0.25rem 0 0;
}
.inv-media-hint {
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
}
.inv-block-mt {
    margin-top: 1rem;
}
.inv-p-desc {
    margin-top: 1rem;
}
.inv-qty-pos {
    color: var(--ok);
}
.inv-qty-neg {
    color: var(--danger);
}
code.inv-code-sm {
    font-size: 0.85rem;
}
.btn.btn-ghost--compact {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
}
.label-req-asterisk {
    font-weight: 600;
}
.js-product-tax-preview {
    margin: 0.25rem 0 0;
}
.pagination-actions {
    margin-top: 1rem;
    justify-content: center;
}
.pagination-actions .is-disabled,
.btn-ghost.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* 商品ロット fieldset */
.product-lots-box {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin: 0;
}
.product-lots-legend {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0 0.35rem;
}
.product-lots-lead {
    margin: 0 0 0.65rem;
    font-size: 0.82rem;
}
.product-lot-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: 0.65rem;
    align-items: end;
    margin-bottom: 0.5rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--border);
}
.product-lot-row .actions {
    padding-top: 0;
}
.btn.product-lot-remove,
.product-lot-row .product-lot-remove {
    font-size: 0.82rem;
}
#product-lot-add {
    margin-top: 0.35rem;
}

/* バーコードスキャン */
.inv-scan-detail-line {
    margin-bottom: 0.35rem;
}
#inv-scan-routes {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}
#new-product-panel {
    display: none;
    border-color: var(--accent);
}
#panel {
    display: none;
}
#cam-stop {
    display: none;
}
.scan-lookup-h1 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
}
#lookup-form.scan-lookup-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.scan-lookup-form__field {
    flex: 1;
    min-width: 200px;
}
#lookup-msg,
#adjust-msg {
    margin-top: 0.75rem;
    min-height: 1.25rem;
}
.scan-h2-tight {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
}
.scan-mb-1 {
    margin: 0 0 1rem;
}
.scan-mb-05 {
    margin: 0 0 0.5rem;
}
.scan-mb-075 {
    margin: 0 0 0.75rem;
}
.scan-mb-065 {
    margin: 0 0 0.65rem;
}
.scan-txt-spacing {
    letter-spacing: 0.05em;
}
#p-name {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}
#p-details {
    margin: 0 0 1rem;
    font-size: 0.92rem;
    line-height: 1.5;
}
#p-desc-block,
#p-img-block,
#p-lots-block {
    margin: 0 0 1rem;
    display: none;
}
#p-show-link {
    display: none;
}
.scan-table-wrap {
    overflow-x: auto;
}
.scan-lots-table {
    width: 100%;
    font-size: 0.88rem;
}
#p-desc {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}
#p-img {
    max-width: 100%;
    max-height: 240px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.row.scan-panel-actions {
    margin: 0 0 1rem;
    gap: 0.75rem;
}
#amount {
    max-width: 10rem;
}
#lot-scan-fields {
    display: none;
    margin: 0 0 1rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}
#lot-scan-fields p.muted {
    margin: 0 0 0.65rem;
    font-size: 0.88rem;
    line-height: 1.45;
}
#lot-scan-fields .row.row-2 {
    gap: 0.75rem;
}
.scan-amount-col {
    flex: 1;
    min-width: 160px;
}

.reports-hub-links {
    margin-top: 1.25rem;
}
.reports-hub-links p {
    margin: 0 0 0.65rem;
}
.bp-documents-hub .btn {
    display: inline-block;
}
a.bp-order-code-link {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
a.bp-order-code-link:hover {
    color: var(--accent-hi);
}
a.bp-order-code-link code {
    color: inherit;
    background: transparent;
}

/* 取引先一覧：名前＝編集、操作は注文追加＋削除 */
.bp-partners-index__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.bp-partners-index__title-block {
    min-width: 0;
}
.bp-partners-index__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
}
.bp-partners-index__subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.82rem;
    line-height: 1.4;
}
.bp-partners-index__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    margin-left: auto;
}
.bp-partners-index__summary {
    margin: 0 0 0.65rem;
    font-size: 0.88rem;
}
.bp-partners-index__empty {
    margin: 0.5rem 0 0;
    font-size: 0.92rem;
}
.bp-partners-index {
    overflow: visible;
}
.bp-partners-table {
    width: 100%;
    margin: 0 0 0.75rem;
    border-collapse: collapse;
}
.bp-partners-table thead th {
    padding: 0.6rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
    color: var(--muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}
.bp-partners-table tbody td {
    padding: 0.7rem 0.75rem;
    vertical-align: top;
    font-size: 0.9rem;
    line-height: 1.45;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.bp-partners-table tbody tr:last-child td {
    border-bottom: none;
}
.bp-partners-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.03);
}
.bp-partners-table__name {
    min-width: 11rem;
    max-width: 16rem;
}
.bp-partners-table__name .bp-partner-edit-link {
    display: inline;
}
.bp-partners-table__name .bp-suite-badge {
    display: inline-block;
    margin: 0.25rem 0 0;
    margin-left: 0;
}
.bp-partners-table__id code {
    font-size: 0.82rem;
    padding: 0.12rem 0.35rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.04);
}
.bp-partners-table__postal {
    white-space: nowrap;
    font-size: 0.86rem;
}
.bp-partners-table__addr {
    min-width: 12rem;
    max-width: 22rem;
    font-size: 0.86rem;
    word-break: break-word;
}
.bp-partners-table__actions-head,
.bp-partners-table__actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}
.bp-partners-table__actions .bp-index-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}
.bp-partners-table tbody tr {
    position: relative;
    z-index: 0;
}
.bp-partners-table tbody tr:has(.bp-orders-detail[open]) {
    z-index: 8;
}
.bp-partners-table .bp-order-no-cell {
    position: relative;
    overflow: visible;
    min-width: 10rem;
}
.bp-partners-table .bp-order-no-cell__wrap {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.35rem;
}
.bp-partners-table .bp-orders-detail {
    position: relative;
}
.bp-partners-table .bp-orders-detail__list {
    margin: 0;
    min-width: 16rem;
    max-width: min(22rem, 92vw);
    max-height: 10.5rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}
.bp-partners-table .bp-orders-detail__list li {
    padding: 0.3rem 0.6rem;
}
.bp-partners-table__delete {
    color: var(--danger, #b91c1c);
    border-color: rgba(185, 28, 28, 0.25);
}
.bp-partners-table__delete:hover {
    color: #fff;
    background: var(--danger, #b91c1c);
    border-color: var(--danger, #b91c1c);
}
.bp-partners-index .pagination-actions {
    margin-top: 0.25rem;
    justify-content: center;
}
@media (max-width: 720px) {
    .bp-partners-index__head {
        flex-direction: column;
        align-items: stretch;
    }
    .bp-partners-index__actions {
        margin-left: 0;
        justify-content: flex-start;
    }
}

a.bp-partner-edit-link {
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}
a.bp-partner-edit-link:hover {
    color: var(--accent);
    border-bottom-color: rgba(37, 99, 235, 0.35);
}

.bp-index-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    vertical-align: middle;
}

/* スタッフ（ログインユーザー）一覧：編集・削除を同じ高さで横並び、列幅を揃える */
td.staff-user-actions {
    vertical-align: middle;
    width: 1%;
    white-space: nowrap;
}
.staff-user-actions__row {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
}
.staff-user-actions__row > .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}
.staff-user-actions__row .inv-inline-form .btn {
    white-space: nowrap;
}
.staff-user-actions__row .inv-inline-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
    vertical-align: middle;
}
.staff-user-actions__dummy {
    visibility: hidden;
    pointer-events: none;
    user-select: none;
}

.staff-users-lead {
    margin: 0 0 1rem;
}

/* ログインユーザー一覧 — モバイル */
@media (max-width: 719px) {
    .staff-users-page {
        padding: 0.85rem 0.7rem 1rem;
    }

    .staff-users-head.inv-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
        margin-bottom: 0.65rem;
    }

    .staff-users-head .inv-title-tight {
        font-size: 1.05rem;
        text-align: center;
    }

    .staff-users-head__actions {
        width: 100%;
        justify-content: stretch;
    }

    .staff-users-head__actions .btn {
        width: 100%;
        min-height: 2.55rem;
        font-size: 0.92rem;
    }

    .staff-users-lead {
        margin-bottom: 0.85rem;
        font-size: 0.82rem;
        line-height: 1.5;
    }

    .staff-users-table-wrap {
        overflow: visible;
        margin: 0;
    }

    .staff-users-table {
        min-width: 0;
    }

    .staff-users-table thead {
        display: none;
    }

    .staff-users-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
    }

    .staff-users-table__row {
        display: flex;
        flex-direction: column;
        padding: 0.75rem 0.8rem;
        border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    }

    .staff-users-table__row td {
        display: grid;
        grid-template-columns: 5.5rem minmax(0, 1fr);
        gap: 0.25rem 0.65rem;
        align-items: start;
        padding: 0.28rem 0;
        border-bottom: none;
        font-size: 0.88rem;
        line-height: 1.4;
        text-align: left !important;
        width: auto;
        white-space: normal;
    }

    .staff-users-table__row td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 600;
        color: var(--muted, #64748b);
        line-height: 1.35;
    }

    .staff-users-table__name-col {
        display: block;
        order: -10;
        padding: 0 0 0.45rem;
        margin-bottom: 0.35rem;
        border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08));
        font-size: 1rem;
        line-height: 1.35;
        word-break: break-word;
    }

    .staff-users-table__name-col::before {
        display: none;
    }

    .staff-users-table__name-col strong {
        font-weight: 700;
    }

    .staff-users-table__email-col {
        word-break: break-all;
    }

    .staff-users-table__staff-id-col--empty {
        display: none;
    }

    .staff-users-table__id-col {
        font-size: 0.82rem;
    }

    .staff-users-table__actions-col {
        display: block !important;
        order: 10;
        padding-top: 0.5rem;
        margin-top: 0.15rem;
        border-top: 1px solid var(--border, rgba(0, 0, 0, 0.08));
    }

    .staff-users-table__actions-col::before {
        display: none;
    }

    .staff-users-table__actions-col .staff-user-actions__row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
        width: 100%;
        justify-content: stretch;
    }

    .staff-users-table__actions-col .staff-user-actions__row:has(.staff-user-actions__dummy) {
        grid-template-columns: 1fr;
    }

    .staff-users-table__actions-col:has(.staff-users-table__no-actions) {
        display: none !important;
    }

    .staff-users-table__actions-col .staff-user-actions__row > .btn,
    .staff-users-table__actions-col .staff-user-actions__row .inv-inline-form,
    .staff-users-table__actions-col .staff-user-actions__row .inv-inline-form .btn,
    .staff-users-table__actions-col .staff-user-actions__row .staff-user-actions__dummy {
        width: 100%;
        min-height: 2.45rem;
        margin: 0;
        justify-content: center;
        font-size: 0.88rem;
    }

    .staff-users-table__actions-col .staff-user-actions__dummy {
        display: none;
    }

    .staff-users-page .pagination-actions {
        justify-content: center;
        margin-top: 0.85rem;
    }
}

.inv-inline-form {
    display: inline;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

.bp-index-actions .inv-inline-form {
    display: inline-flex;
    vertical-align: middle;
}

/* 取引先一覧：複数注文を（全N件）から開く */
.bp-order-no-cell__wrap {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.35rem;
}
.bp-orders-detail {
    display: inline-block;
    position: relative;
    vertical-align: baseline;
}
.bp-orders-detail__summary {
    cursor: pointer;
    list-style: none;
    display: inline;
    color: var(--muted);
    font-size: 0.88em;
    user-select: none;
}
.bp-orders-detail__summary::-webkit-details-marker {
    display: none;
}
.bp-orders-detail__summary::after {
    content: ' ▼';
    font-size: 0.75em;
    opacity: 0.75;
}
.bp-orders-detail[open] .bp-orders-detail__summary::after {
    content: ' ▲';
}
.bp-orders-detail__list {
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    margin: 0;
    padding: 0.35rem 0;
    min-width: 15rem;
    max-width: min(22rem, 92vw);
    list-style: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    z-index: 30;
}
.bp-orders-detail__list li {
    margin: 0;
    padding: 0.35rem 0.65rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem 0.75rem;
}
.bp-orders-detail__line {
    flex: 1;
    min-width: 0;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
}
.bp-orders-detail__line:hover {
    color: var(--accent-hi);
    text-decoration: underline;
}
.bp-orders-detail__n {
    margin-right: 0.25rem;
}
.bp-orders-detail__code {
    font-size: 0.85em;
}
.bp-orders-detail__edit {
    flex-shrink: 0;
    font-size: 0.82rem;
    color: var(--muted);
    text-decoration: none;
}
.bp-orders-detail__edit:hover {
    color: var(--text);
    text-decoration: underline;
}

/* 棚卸：スキャン入力 */
.stocktake-quick-panel {
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f1f5f9;
}
.stocktake-quick-panel__title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.02em;
}
.stocktake-quick-panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    margin-bottom: 0.85rem;
}
.stocktake-quick-panel__intro {
    flex: 1 1 16rem;
    min-width: 0;
}
.stocktake-quick-panel__hint {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
}
.stocktake-quick-panel__date {
    flex: 0 0 auto;
    min-width: 10.5rem;
    margin-left: auto;
    text-align: right;
}
.stocktake-quick-panel__date label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
}
.stocktake-quick-panel__date input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.stocktake-confirm-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin: 0 0 0.85rem;
    padding: 0.7rem 0.85rem;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
}
.stocktake-confirm-bar__status {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text);
}
.stocktake-confirm-bar__form {
    margin: 0;
}
.stocktake-status {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.35;
}
.stocktake-status--draft {
    color: #9a3412;
    background: #ffedd5;
}
.stocktake-status--posted {
    color: #166534;
    background: #dcfce7;
}
.stocktake-quick-form__scan {
    margin-bottom: 0.85rem;
}
.stocktake-quick-form__scan > label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
}
.stocktake-quick-form__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 0.75rem 1rem;
    padding-top: 0.15rem;
    border-top: 1px solid #dbe3ec;
}
.stocktake-quick-form__actions label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
}
.stocktake-quick-form__actions input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.stocktake-quick-form__quantity {
    flex: 0 0 6.5rem;
    min-width: 5.5rem;
}
.stocktake-quick-form__quantity input {
    text-align: right;
}
.stocktake-quick-form__grid {
    display: grid;
    gap: 0.75rem 1rem;
    align-items: end;
    grid-template-columns: 1fr;
}
@media (min-width: 720px) {
    .stocktake-quick-form__grid {
        grid-template-columns: minmax(0, 1fr) minmax(5rem, 7rem) auto;
    }
}
.stocktake-product-preview {
    margin-top: 0.55rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
    background: #fff;
}
.stocktake-product-preview__name {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
    word-break: break-word;
}
.stocktake-product-preview__meta {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    line-height: 1.35;
}
.stocktake-product-suggest {
    position: absolute;
    z-index: 30;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    max-height: 14rem;
    overflow: auto;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.stocktake-product-suggest__item {
    padding: 0.5rem 0.7rem;
    cursor: pointer;
}
.stocktake-product-suggest__item:hover,
.stocktake-product-suggest__item:focus {
    background: #eff6ff;
    outline: none;
}
.stocktake-product-suggest__name {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
}
.stocktake-product-suggest__sub {
    margin-top: 0.15rem;
    font-size: 0.78rem;
    line-height: 1.3;
}
.stocktake-product-suggest__empty {
    padding: 0.55rem 0.7rem;
    font-size: 0.84rem;
    color: var(--muted);
}
.stocktake-barcode-field__row {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}
.stocktake-barcode-field__pick {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
}
.stocktake-barcode-field__pick input {
    width: 100%;
    box-sizing: border-box;
}
.stocktake-barcode-field__row input {
    min-width: 0;
}
.stocktake-barcode-field__camera {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    min-height: 2.5rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    align-self: stretch;
}
.stocktake-barcode-field__camera:hover {
    background: #e2e8f0;
}
.stocktake-barcode-field__camera svg {
    width: 1.25rem;
    height: 1.25rem;
}
.stocktake-barcode-field__camera:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.stocktake-camera-https-notice {
    margin: 0.45rem 0 0;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #9a3412;
    background: #ffedd5;
    border: 1px solid #fdba74;
}
.stocktake-camera-https-notice code {
    font-size: 0.92em;
}
.stocktake-barcode-scanner {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.82);
}
.stocktake-barcode-scanner[hidden] {
    display: none !important;
}
body.stocktake-barcode-scanner-open {
    overflow: hidden;
}
.stocktake-barcode-scanner__dialog {
    width: min(100%, 52rem);
    max-height: calc(100vh - 1.5rem);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.stocktake-barcode-scanner__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}
.stocktake-barcode-scanner__actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.stocktake-barcode-scanner__torch {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
}
.stocktake-barcode-scanner__torch[aria-pressed="true"] {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}
.stocktake-barcode-scanner__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}
.stocktake-barcode-scanner__close {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
}
.stocktake-barcode-scanner__view {
    flex: 1 1 auto;
    min-height: min(78vh, 42rem);
    background: #000;
}
.stocktake-barcode-scanner__view video,
.stocktake-barcode-scanner__video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000;
}
.stocktake-barcode-scanner__view canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}
.stocktake-barcode-scanner__view--native {
    display: flex;
    align-items: center;
    justify-content: center;
}
.stocktake-barcode-scanner__view--quagga {
    position: relative;
    overflow: hidden;
}
.stocktake-barcode-scanner__view--quagga video,
.stocktake-barcode-scanner__view--quagga canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}
.stocktake-barcode-scanner__view #qr-shaded-region {
    border-width: 2px !important;
    border-color: rgba(96, 165, 250, 0.95) !important;
}
.stocktake-barcode-scanner__status {
    margin: 0;
    padding: 0.85rem 1rem 1rem;
    font-size: 0.95rem;
    text-align: center;
    flex: 0 0 auto;
}
@media (max-width: 640px) {
    .stocktake-barcode-scanner {
        padding: 0;
        align-items: stretch;
    }
    .stocktake-barcode-scanner__dialog {
        width: 100%;
        max-height: none;
        min-height: 100%;
        border-radius: 0;
    }
    .stocktake-barcode-scanner__view {
        min-height: 0;
        flex: 1 1 auto;
    }
}
.stocktake-history {
    margin-top: 1.35rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.stocktake-history__title {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}
.stocktake-history__empty {
    margin: 0;
    font-size: 0.88rem;
}
.stocktake-history__table {
    font-size: 0.9rem;
}
.stocktake-history__table th,
.stocktake-history__table td {
    vertical-align: middle;
}
.stocktake-history__reentry-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.06rem 0.35rem;
    border-radius: 999px;
    background: #e8f1ff;
    border: 1px solid rgba(29, 79, 145, 0.28);
    color: #1d4f91;
    font-size: 0.68rem;
    font-weight: 700;
    vertical-align: middle;
    line-height: 1.2;
}
.stocktake-quick-form__submit {
    display: flex;
    align-items: flex-end;
    padding-bottom: 1px;
}
.stocktake-quick-form__submit .btn {
    min-width: 5.5rem;
}
.stocktake-quick-form__err {
    margin: 0.5rem 0 0;
    font-size: 0.88rem;
}

.stocktake-confirm-dialog {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0;
    max-width: 24rem;
    width: calc(100% - 2rem);
}

.stocktake-confirm-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.stocktake-confirm-dialog__panel {
    padding: 1.25rem;
}

.stocktake-confirm-dialog__message {
    margin: 0 0 0.5rem;
    font-weight: 600;
    line-height: 1.5;
}

.stocktake-confirm-dialog__hint {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    line-height: 1.45;
}

.stocktake-confirm-dialog__continue {
    margin-bottom: 1rem;
}

.stocktake-confirm-dialog__label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
}

.stocktake-confirm-dialog__memo {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    resize: vertical;
    min-height: 4.5rem;
}

.stocktake-confirm-dialog__memo:focus {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    border-color: #2563eb;
}

.stocktake-confirm-dialog__field-error {
    margin: 0.45rem 0 0;
    font-size: 0.85rem;
    color: #b91c1c;
}

.stocktake-confirm-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* 棚卸：一覧 */
.stocktake-list-foot {
    margin: 0.25rem 0 1rem;
}
.stocktake-list__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 0.85rem;
}
.stocktake-list__head .stocktake-list-summary {
    margin: 0;
}
.stocktake-list__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
}
.stocktake-list__exports {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.stocktake-list__export-btn {
    font-size: 0.88rem;
    padding: 0.4rem 0.85rem;
    white-space: nowrap;
}
.stocktake-list-summary {
    font-size: 0.88rem;
}
.stocktake-list-summary__sep {
    margin: 0 0.35rem;
}
.stocktake-list-table-wrap {
    max-height: min(70vh, 52rem);
    overflow: auto;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.stocktake-list-table {
    width: 100%;
    font-size: 0.9rem;
}
.stocktake-list-table th,
.stocktake-list-table td {
    vertical-align: middle;
}
.stocktake-list-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
    background: var(--card, #fff);
    box-shadow: inset 0 -1px 0 var(--border);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #475569;
}
.stocktake-list-table code {
    font-size: 0.85em;
}
.stocktake-list-table__name {
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stocktake-list-table__sort {
    color: inherit;
    text-decoration: none;
    font-weight: inherit;
}
.stocktake-list-table__sort:hover {
    color: var(--primary);
    text-decoration: underline;
}
.stocktake-list-table__sort.is-active {
    color: var(--primary);
    font-weight: 700;
}
.stocktake-list-table__diff-head {
    padding-right: 0.35rem;
}
.stocktake-list-table__diff-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    max-width: 7.5rem;
    margin-left: auto;
    display: block;
    border: none;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748b' d='M1 1l4 4 4-4'/%3E%3C/svg%3E")
        no-repeat right 0.1rem center / 0.55rem auto,
        transparent;
    padding: 0 0.95rem 0 0;
    font: inherit;
    font-weight: inherit;
    color: inherit;
    cursor: pointer;
    text-align: right;
}
.stocktake-list-table__diff-select:hover,
.stocktake-list-table__diff-select:focus {
    color: var(--primary);
    outline: none;
}
.stocktake-list-table__diff-select.is-active {
    color: var(--primary);
    font-weight: 700;
}
.stocktake-list-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 1rem;
}
.stocktake-list-pagination__page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.35rem 0.55rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    font-size: 0.88rem;
}
.stocktake-list-pagination__page.is-active {
    border-color: var(--primary);
    background: #eff6ff;
    color: var(--primary);
    font-weight: 700;
}

@media (max-width: 719px) {
    .stocktake-page.card {
        padding: 0.75rem 0.65rem 0.9rem;
        border-radius: 10px;
    }
    .stocktake-page .inv-title-tight {
        font-size: 1rem;
        line-height: 1.35;
        margin-bottom: 0.65rem;
    }
    .stocktake-quick-panel {
        margin-bottom: 0.85rem;
        padding: 0.7rem 0.65rem 0.75rem;
    }
    .stocktake-quick-panel__title,
    .stocktake-history__title {
        font-size: 0.88rem;
    }
    .stocktake-quick-panel__head {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: flex-end;
        justify-content: space-between;
        gap: 0.5rem 0.65rem;
        margin-bottom: 0.65rem;
    }
    .stocktake-quick-panel__intro {
        flex: 1 1 auto;
        min-width: 0;
    }
    .stocktake-quick-panel__title {
        margin: 0;
        line-height: 1.3;
    }
    .stocktake-quick-panel__date {
        flex: 0 0 auto;
        width: auto;
        min-width: 0;
        max-width: 10.5rem;
        margin-left: 0;
        text-align: right;
    }
    .stocktake-quick-panel__date label {
        font-size: 0.78rem;
        margin-bottom: 0.15rem;
    }
    .stocktake-quick-panel__date input {
        min-height: 2.5rem;
        padding: 0.5rem 0.55rem;
        font-size: 0.95rem;
    }
    .stocktake-quick-form__scan {
        margin-bottom: 0.65rem;
    }
    .stocktake-quick-form__scan > label {
        font-size: 0.78rem;
        margin-bottom: 0.2rem;
    }
    .stocktake-barcode-field__pick input {
        min-height: 2.75rem;
        padding: 0.65rem 0.7rem;
        font-size: 1rem;
    }
    .stocktake-barcode-field__camera {
        width: 3.25rem;
        min-height: 2.75rem;
        border-radius: 10px;
    }
    .stocktake-barcode-field__camera svg {
        width: 1.45rem;
        height: 1.45rem;
    }
    .stocktake-product-preview {
        margin-top: 0.45rem;
        padding: 0.5rem 0.65rem;
    }
    .stocktake-product-preview__name {
        font-size: 0.85rem;
    }
    .stocktake-product-preview__meta {
        font-size: 0.76rem;
    }
    .stocktake-product-suggest {
        max-height: min(40vh, 16rem);
    }
    .stocktake-quick-form__actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        padding-top: 0.6rem;
    }
    .stocktake-quick-form__actions label {
        font-size: 0.78rem;
        margin-bottom: 0.15rem;
    }
    .stocktake-quick-form__quantity {
        flex: none;
        width: 100%;
        min-width: 0;
    }
    .stocktake-quick-form__actions input {
        min-height: 2.75rem;
        padding: 0.65rem 0.7rem;
        font-size: 1.05rem;
        text-align: left;
    }
    .stocktake-quick-form__submit {
        align-items: stretch;
        width: 100%;
        padding-bottom: 0;
    }
    .stocktake-quick-form__submit .btn {
        width: 100%;
        min-width: 0;
        min-height: 3rem;
        font-size: 1.05rem;
        font-weight: 700;
    }
    .stocktake-history {
        margin-top: 1rem;
        padding-top: 0.85rem;
    }
    .stocktake-history__title {
        line-height: 1.4;
        margin-bottom: 0.65rem;
    }
    .stocktake-list__head {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
        margin-bottom: 0.65rem;
    }
    .stocktake-history__empty,
    .stocktake-list-foot {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    .stocktake-history__table {
        font-size: 0.82rem;
    }
    .stocktake-history__table th,
    .stocktake-history__table td {
        padding: 0.45rem 0.35rem;
        white-space: nowrap;
    }
    .stocktake-list-table-wrap {
        max-height: none;
        overflow-x: auto;
        overflow-y: visible;
        margin-bottom: 0.5rem;
        border: none;
        border-radius: 0;
    }
    .stocktake-list-table {
        font-size: 0.82rem;
    }
    .stocktake-list-table th,
    .stocktake-list-table td {
        padding: 0.45rem 0.35rem;
    }
    .stocktake-list-table code {
        font-size: 0.78rem;
        word-break: break-all;
        white-space: normal;
    }
    .stocktake-list-summary {
        font-size: 0.82rem;
        line-height: 1.45;
    }
    .stocktake-list-pagination__page {
        min-width: 2.35rem;
        min-height: 2.35rem;
        font-size: 0.9rem;
    }
}

/* スタッフ（ユーザー管理） */
.staff-user-form > div,
.staff-user-form > fieldset {
    margin-bottom: 0.9rem;
}
.staff-user-form label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
}
.staff-user-form input[type="text"],
.staff-user-form input[type="email"],
.staff-user-form input[type="password"] {
    width: 100%;
    max-width: 28rem;
    box-sizing: border-box;
}
.staff-user-roles {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem 1rem;
    margin: 0;
}
.staff-user-roles legend {
    padding: 0 0.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.staff-user-roles__groups {
    display: grid;
    gap: 0.85rem;
}
@media (min-width: 900px) {
    .staff-user-roles__groups {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }
}
.staff-user-roles__legend {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
}
.staff-user-roles__group {
    padding-top: 0.15rem;
}
.staff-user-roles__group--featured {
    padding: 0.75rem 0.85rem 0.85rem;
    border: 1px solid rgba(59, 130, 246, 0.45);
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.02) 55%, var(--card) 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}
.staff-user-roles__group--featured .staff-user-roles__group-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.55rem;
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.01em;
}
.staff-user-roles__group--featured .staff-user-roles__group-title::before {
    content: "";
    flex-shrink: 0;
    width: 0.28rem;
    height: 1.05rem;
    border-radius: 999px;
    background: linear-gradient(180deg, #60a5fa, #2563eb);
}
.staff-user-roles__group-title {
    margin: 0 0 0.4rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.02em;
}
.staff-user-roles__select-all {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.55rem;
    padding: 0.45rem 0.55rem;
    border: 1px dashed rgba(37, 99, 235, 0.28);
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.05);
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e40af;
    cursor: pointer;
}
.staff-user-roles__select-all input {
    width: auto;
    margin: 0;
    flex-shrink: 0;
}
.staff-user-roles__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
    gap: 0.4rem 1rem;
    align-items: start;
}
@media (max-width: 640px) {
    .staff-user-roles__list {
        grid-template-columns: 1fr;
    }
}
.staff-user-roles__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}
.staff-user-roles__item input {
    width: auto;
    margin: 0;
}
.inv-pill--role {
    display: inline-block;
    margin: 0 0.25rem 0.15rem 0;
    padding: 0.12rem 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    background: rgba(99, 160, 255, 0.12);
    border: 1px solid rgba(99, 160, 255, 0.35);
    border-radius: 6px;
}

@media print {
    .app-mobile-topbar,
    .app-mobile-scrim,
    .app-sidebar__expand-tab {
        display: none !important;
    }
}
