/* =========================================================
   マンダイトレカ発注フォーム CSS整理版
   - PC基本表示
   - SP商品一覧：リスト型・横スクロールなし・ヘッダー固定
   - SPカート：下部メニューからポップアップ表示
========================================================= */

:root{
  --bg:#f6f7fb;
  --card:#fff;
  --bd:#e6e8ef;
  --line:#eef0f6;
  --muted:#8a90a6;
  --text:#1f2a44;
  --pri:#2f6f73;
  --pri-dark:#10484c;
  --danger:#c0392b;
  --soft:#eef6f7;
  --sp-teal:#0f7778;
  --sp-bg:#f7f9fc;
  --sp-line:#e5eaf2;
}

*{
  box-sizing:border-box;
}

[hidden]{
  display:none!important;
}

html,
body{
  width:100%;
  height:100%;
  margin:0;
  padding:0;
  overflow-x:hidden;
}
.main-scroll{
  height:100dvh;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
}
body{
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
  background:var(--bg);
  color:var(--text);
}

input,
select,
button,
textarea{
  font-family:inherit;
  font-size:14px;
  padding:10px;
  border:1px solid #d8dbe6;
  border-radius:10px;
  background:#fff;
}

textarea{
  min-height:84px;
  line-height:1.5;
  resize:vertical;
}

button{
  border:none;
  background:var(--pri);
  color:#fff;
  font-weight:800;
  cursor:pointer;
}

button:disabled{
  opacity:.5;
  cursor:not-allowed;
}

select{
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  padding-right:36px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%238a90a6'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat:no-repeat;
  background-position:right 10px center;
  background-size:18px;
}

/* =========================================================
   COMMON
========================================================= */

.wrap{
  max-width:1180px;
  margin:24px auto;
  padding:0 16px;
}

.grid{
  display:grid;
  grid-template-columns:minmax(0,1.35fr) minmax(360px,.65fr);
  gap:16px;
  height:calc(100vh - 36px);
  align-items:stretch;
}

.card{
  background:var(--card);
  border:1px solid var(--bd);
  border-radius:14px;
  box-shadow:0 10px 25px rgba(0,0,0,.04);
  overflow:hidden;
}

.card h2{
  margin:0;
  padding:16px 16px 10px;
  display:flex;
  gap:10px;
  align-items:center;
  font-size:18px;
}

.pill{
  display:inline-block;
  padding:4px 10px;
  border-radius:999px;
  background:var(--soft);
  color:var(--pri);
  font-size:12px;
  font-weight:700;
}

.muted{
  color:var(--muted);
  font-size:12px;
}

.sold{
  color:var(--danger);
  font-weight:900;
}

.right{
  text-align:right;
}

.center{
  text-align:center;
}

.row{
  display:flex;
  gap:10px;
  align-items:center;
}

.status{
  margin-top:10px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fafbff;
}

.btn-primary{
  background:var(--pri);
  color:#fff;
}

.btn-primary:hover{
  background:#255b5e;
}

/* =========================================================
   LOGIN
========================================================= */

.login-screen{
  min-height:100dvh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:var(--bg);
  overflow:hidden;
}

.login-card{
  width:min(360px,100%);
  padding:32px;
  background:#fff;
  border:1px solid var(--bd);
  border-radius:20px;
  box-shadow:0 18px 45px rgba(15,23,42,.10);
}

.login-brand{
  margin-bottom:26px;
  color:#10233f;
  font-size:26px;
  font-weight:00;
  line-height:1.35;
}

.login-field{
  margin-bottom:14px;
}

.login-label{
  display:block;
  margin-bottom:7px;
  color:#1f2a44;
  font-size:13px;
  font-weight:900;
}

.login-card input{
  width:100%;
  height:48px;
}

.login-card button{
  width:100%;
  height:50px;
  margin-top:4px;
  border-radius:14px;
  background:linear-gradient(135deg,#0b555b,#16857f);
  font-size:15px;
}

.guest-login-btn{
  margin-top:10px!important;
  background:#eef1f6!important;
  color:#1f2937!important;
}

.login-error{
  margin-top:12px;
  color:var(--danger);
  font-size:13px;
  font-weight:800;
  white-space:pre-wrap;
}

/* =========================================================
   APP SHELL / SIDEBAR
========================================================= */

.app-shell{
  min-height:100vh;
  height:100vh;
  display:grid;
  grid-template-columns:248px minmax(0,1fr);
  background:var(--bg);
  overflow:hidden;
}

.sidebar{
  position:sticky;
  top:0;
  height:100vh;
  padding:16px 16px;
  display:flex;
  flex-direction:column;
  gap:10px;
  background:linear-gradient(180deg,#073f43,#062f35);
  color:#fff;
  box-shadow:8px 0 26px rgba(15,23,42,.10);
}

.brand{
  padding:0 6px 6px;
  font-size:18px;
  font-weight:1000;
  line-height:1.35;
}

.nav{
  display:flex;
  flex-direction:column;
  gap:4px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar {
  display: none;
}

.nav a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px;
  border-radius:12px;
  color:#dff7f6;
  text-decoration:none;
  font-size:14px;
  font-weight:900;
  cursor:pointer;
}

.nav a:hover,
.nav a.active{
  background:rgba(255,255,255,.12);
  color:#fff;
}

.nav-divider{
  height:1px;
  margin:10px 4px;
  background:rgba(255,255,255,.22);
}

.admin-caption{
  padding:0 8px;
  color:#b7d8d9;
  font-size:11px;
}

.admin-only[hidden]{
  display:none!important;
}

.account-box{
  margin-top:auto;
  padding-top:16px;
  border-top:1px solid rgba(255,255,255,.18);
  display:flex;
  align-items:center;
  gap:10px;
}

.avatar{
  width:38px;
  height:38px;
  border-radius:999px;
  background:rgba(255,255,255,.16);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:1000;
  line-height:1;
  padding:0;
}

.account-meta{
  min-width:0;
  flex:1;
}

.account-dept{
  font-size:13px;
  font-weight:900;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.account-name{
  color:#b7d8d9;
  font-size:12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.logout-btn{
  padding:8px;
  border:1px solid rgba(255,255,255,.25);
  border-radius:10px;
  background:transparent;
  color:#fff;
  font-size:12px;
}

.guest-side-login{
  background:#fff!important;
  color:#073f43!important;
  border-color:rgba(255,255,255,.55)!important;
}

.mobile-menu-btn,
.sidebar-overlay{
  display:none;
}

.app-main.wrap{
  max-width:none;
  width:100%;
  height:100vh;
  margin:0;
  padding:18px;
  overflow:hidden;
}

/* =========================================================
   PRODUCT LIST / CART PC
========================================================= */

#pageProducts,
#pageDashboard,
#pageOrders,
#pageOrderStatus,
#pageCreateInvoice,
#pageAccount,
#pageMaster,
#pageCategory,
#pageStore,
#sec-requests,
#pageSettings{
  height:100%;
  min-height:0;
}

#pageProducts .card{
  height:100%;
  min-height:0;
  display:flex;
  flex-direction:column;
}

#pageProducts .card > h2,
#pageProducts .toolbar,
#pageProducts .top-note{
  flex:0 0 auto;
}

.toolbar{
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:10px;
  padding:0 16px 12px;
}

.toolbar > *{
  min-width:0;
}

#q{
  flex:0 1 200px;
  min-width:120px;
}

#cat{
  flex:0 0 150px;
}

.priceFilter{
  flex:0 1 auto;
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:10px;
  padding:6px 10px;
  border:1px solid #d8dbe6;
  border-radius:10px;
  background:#fff;
}

.priceFilter .range{
  display:flex;
  align-items:center;
  gap:6px;
}

.priceFilter input[type="number"]{
  width:110px;
  padding:8px 10px;
}

.priceFilter label,
.stockFilter label{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:13px;
  color:#334;
}

.stockFilter{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:6px 10px;
  border:1px solid #d8dbe6;
  border-radius:10px;
  background:#fff;
  white-space:nowrap;
}

.stockFilter input{
  width:16px;
  height:16px;
}

.top-note{
  padding:0 16px 10px;
}

.list{
  flex:1;
  min-height:0;
  overflow:auto;
  border-top:1px solid var(--line);
}

table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  table-layout:fixed;
}

th,
td{
  padding:10px;
  border-top:1px solid var(--line);
  vertical-align:middle;
}

th{
  position:sticky;
  top:0;
  z-index:2;
  background:#fafbff;
  color:#5a6072;
  text-align:center;
  font-size:12px;
}

.img{
  width:52px;
  height:52px;
  object-fit:cover;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fafbff;
}

.subinfo{
  margin-top:4px;
  color:#6b7280;
  font-size:12px;
  font-weight:600;
}

.cat-badge{
  display:inline-block;
  padding:4px 10px;
  border:1px solid rgba(0,0,0,.05);
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  line-height:1;
  white-space:nowrap;
}

.cat-box{ background:#e3f2fd; color:#1565c0; }
.cat-pack{ background:#e8f5e9; color:#2e7d32; }
.cat-deck{ background:#fff3e0; color:#ef6c00; }
.cat-oripa{ background:#3f4344; color:#fff; }
.cat-other{ background:#f3f4f6; color:#555; }
.cat-onepbox{ background:#ede7ff; color:#5b21b6; }
.cat-labubu{ background:#ffe4f1; color:#ad1457; }
.cat-seal{ background:#c6dbe1; color:#215a70; }

.qty,
#pageProducts .qty{
  width:72px;
  text-align:center;
  font-weight:800;
}

.qty-stepper{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:6px;
}

.qty-step-btn{
  display:none;
}

.cart{
  flex:1;
  min-height:0;
  padding:0 16px 16px;
  overflow:auto;
}

.cart-lines{
  margin-top:8px;
}

.cart-line{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:10px 0;
  border-bottom:1px dashed var(--line);
}

.cart-name{
  font-weight:800;
}

.sum{
  margin-top:10px;
}

.sum-row{
  display:flex;
  justify-content:space-between;
  padding:8px 0;
}

.sum-total{
  margin-top:8px;
  padding:12px;
  border:1px solid #cfe7e9;
  border-radius:12px;
  background:#f3fbfb;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.sum-total .label,
.sum-total .value{
  font-weight:1000;
}

.sum-total .value{
  font-size:18px;
}

#btnOrder{
  width:100%;
  min-height:46px;
  border-radius:12px;
  background:linear-gradient(135deg,#0b555b,#087f7b);
  color:#fff;
  font-size:15px;
  font-weight:900;
}

/* =========================================================
   ORDER MODAL
========================================================= */

.om-backdrop{
  position:fixed;
  inset:0;
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  background:rgba(0,0,0,.35);
}

.om-card{
  width:min(560px,100%);
  padding:16px;
  background:#fff;
  border-radius:16px;
  box-shadow:0 10px 30px rgba(0,0,0,.2);
}

.om-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

.om-field{
  padding:10px;
  border:1px solid var(--bd);
  border-radius:12px;
}

.om-label{
  margin-bottom:6px;
  color:#6b7280;
  font-size:12px;
}

.om-value{
  font-weight:800;
  word-break:break-word;
}

.om-total{
  grid-column:1/-1;
}

.om-totalValue{
  font-size:18px;
}

.om-caution{
  margin-top:10px;
  padding:10px;
  border:1px solid rgba(192,57,43,.25);
  border-radius:12px;
  background:rgba(192,57,43,.06);
  color:var(--danger);
  font-size:13px;
  font-weight:900;
}

.om-actions{
  display:flex;
  gap:10px;
  margin-top:12px;
}

.om-actions button{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
}

.om-primary{ background:var(--pri); color:#fff; }
.om-secondary{ background:#eef1f6; color:#111827; }
.om-center{ text-align:center; padding:18px 6px; }
.om-strong{ font-weight:900; }
.om-muted{ margin-top:8px; color:#6b7280; font-size:12px; }
.om-orderNo{ margin:6px 0 10px; font-size:20px; font-weight:1000; }

.om-spinner{
  width:34px;
  height:34px;
  margin:10px auto 0;
  border:4px solid #d8dde6;
  border-top-color:var(--pri);
  border-radius:999px;
  animation:omspin 1s linear infinite;
}

@keyframes omspin{
  to{ transform:rotate(360deg); }
}

.om-error{
  margin-top:10px;
  color:var(--danger);
  font-weight:900;
  white-space:pre-wrap;
}

/* =========================================================
   DASHBOARD / ORDERS / ACCOUNT / MASTER
========================================================= */

.page-card,
.dashboard-card,
.orders-card,
.master-form-card,
.master-list-card{
  padding:20px;
  background:#fff;
  border:1px solid var(--bd);
  border-radius:14px;
  box-shadow:0 10px 25px rgba(0,0,0,.04);
}

.page-card,
.dashboard-card,
.orders-card{
  height:calc(100vh - 36px);
  overflow:hidden;
}

.page-head,
.dashboard-head,
.orders-head,
.master-head,
.account-list-head,
.master-list-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:14px;
}

.page-head h2,
.dashboard-head h2,
.orders-head h2,
.master-head h2{
  margin:0 0 6px;
  padding:0;
  font-size:22px;
}

.dashboard-toolbar,
.orders-toolbar,
.account-filter-box{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin:0 0 14px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#f8fafc;
}

.dashboard-body,
.orders-table-wrap,
.account-table-wrap,
.master-table-wrap{
  overflow:auto;
  border:1px solid var(--line);
  border-radius:14px;
}


/* 注文履歴：過去分も縦スクロールで閲覧できるようにする */
.orders-card{
  display:flex;
  flex-direction:column;
  min-height:0;
}
.orders-head,
.orders-toolbar{
  flex:0 0 auto;
}
.orders-table-wrap{
  flex:1 1 auto;
  min-height:0;
  max-height:calc(100vh - 210px);
  overflow:auto!important;
}
.orders-table th{
  position:sticky;
  top:0;
  z-index:3;
}

.dashboard-kpis{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin-bottom:14px;
}

.kpi-card,
.dash-panel{
  padding:16px;
  border:1px solid var(--line);
  border-radius:16px;
  background:#fff;
  box-shadow:0 8px 18px rgba(15,23,42,.04);
}

.kpi-label,
.kpi-sub{
  color:#64748b;
  font-size:12px;
  font-weight:800;
}

.kpi-value{
  color:#0f172a;
  font-size:24px;
  font-weight:1000;
}

.dashboard-grid{
  display:grid;
  grid-template-columns:1.2fr .8fr;
  gap:14px;
}

.dash-chart{
  width:100%;
  min-height:240px;
}

.dash-bar-row{
  display:grid;
  grid-template-columns:120px 1fr 100px;
  gap:10px;
  align-items:center;
  margin:10px 0;
  font-size:13px;
  font-weight:800;
}

.dash-bar-track{
  height:12px;
  border-radius:999px;
  background:#edf2f7;
  overflow:hidden;
}

.dash-bar-fill{
  height:100%;
  min-width:2px;
  border-radius:999px;
  background:var(--pri);
}

.dash-empty{
  min-height:160px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px dashed #d8dee9;
  border-radius:14px;
  background:#f8fafc;
  color:#64748b;
  font-weight:800;
}

.orders-table,
.account-table,
.master-table,
.dash-table{
  width:100%;
  margin:0;
  border-collapse:separate;
  border-spacing:0;
  table-layout:fixed;
}

.orders-table{
  min-width:980px;
}

.account-table{
  min-width:760px;
}

.master-table{
  min-width:860px;
}

.order-status-badge,
.role-badge,
.master-badge-active,
.master-badge-inactive{
  display:inline-flex;
  align-items:center;
  padding:5px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
}

.order-status-badge{ background:#eef7f3; color:#166534; }
.status-shipped{ background:#e8f4ff!important; color:#155e9c!important; }
.status-received{ background:#fee2e2!important; color:#b91c1c!important; }
.status-preparing{ background:#fef3c7!important; color:#92400e!important; }
.role-admin{ background:#e8f4ff; color:#155e9c; }
.role-order{ background:#eef7f3; color:#166534; }
.master-badge-active{ background:#eef7f3; color:#166534; }
.master-badge-inactive{ background:#f3f4f6; color:#64748b; }

.account-page-form,
.master-form{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
  margin:16px 0 12px;
}

.master-form{
  grid-template-columns:1fr 1fr;
}

.master-form .full{
  grid-column:1/-1;
}

.field label,
.master-form label{
  display:block;
  margin-bottom:6px;
  color:#5a6072;
  font-size:12px;
  font-weight:900;
}

.field input,
.field select,
.master-form input,
.master-form select,
.master-form textarea{
  width:100%;
}

.account-actions,
.master-actions,
.table-actions,
.master-row-actions,
.order-detail-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.btn-light{
  background:#eef1f6!important;
  color:#1f2937!important;
}

.btn-danger{
  background:var(--danger)!important;
  color:#fff!important;
}

.danger-outline{
  background:#fff!important;
  color:var(--danger)!important;
  border:1px solid rgba(192,57,43,.35)!important;
}

.master-page-grid{
  display:grid;
  grid-template-columns:380px minmax(0,1fr);
  gap:16px;
  height:calc(100vh - 36px);
}

.master-form-card,
.master-list-card{
  height:100%;
  overflow:auto;
}

.master-list-card{
  display:flex;
  flex-direction:column;
  min-width:0;
}

.master-table-wrap{
  flex:1;
  min-height:0;
}

.master-thumb,
.master-image-preview{
  object-fit:cover;
  border:1px solid var(--line);
  border-radius:10px;
  background:#f8fafc;
}

.master-thumb{
  width:46px;
  height:46px;
}

.master-image-preview{
  width:92px;
  height:92px;
  margin-top:8px;
}

.master-upload-box{
  padding:12px;
  border:1px dashed #cbd5e1;
  border-radius:14px;
  background:#f8fafc;
}

.master-upload-label{
  min-height:44px;
  display:flex!important;
  align-items:center;
  justify-content:center;
  border:1px solid #e2e8f0;
  border-radius:12px;
  background:#fff;
  color:#1f2a44!important;
  font-weight:900!important;
  cursor:pointer;
}

.master-upload-label input{
  display:none;
}

.master-stock-input{
  width:72px!important;
  height:34px;
  padding:6px 8px;
  text-align:right;
}

.drag-handle,
.account-drag-handle{
  cursor:grab;
  color:#64748b;
  font-size:18px;
  font-weight:1000;
  user-select:none;
}

/* =========================================================
   SP BASE
========================================================= */

.sp-cart-fab,
.sp-cart-backdrop,
.sp-bottom-nav,
.sp-filter-panel{
  display:none;
}

body:not(.is-authenticated) .sp-bottom-nav,
body:not(.is-authenticated) .sp-cart-fab,
body:not(.is-authenticated) #spCartBackdrop{
  display:none!important;
}

@media (max-width:1180px){
  .master-page-grid{
    grid-template-columns:1fr;
    height:auto;
  }
  .master-form-card,
  .master-list-card{
    height:auto;
  }
}

@media (max-width:1100px){
  
/* 注文履歴：過去分も縦スクロールで閲覧できるようにする */
.orders-card{
  display:flex;
  flex-direction:column;
  min-height:0;
}
.orders-head,
.orders-toolbar{
  flex:0 0 auto;
}
.orders-table-wrap{
  flex:1 1 auto;
  min-height:0;
  max-height:calc(100vh - 210px);
  overflow:auto!important;
}
.orders-table th{
  position:sticky;
  top:0;
  z-index:3;
}

.dashboard-kpis{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .dashboard-grid{
    grid-template-columns:1fr;
  }
}

@media (max-width:980px){

  input,
  select,
  textarea{
    font-size:16px!important;
  }

  html,
  body{
    width:100%;
    height:100dvh;
    min-height:100dvh;
    overflow:hidden;
    background:var(--sp-bg);
  }

  body{
    padding:0 0 68px!important;
  }

  .mobile-menu-btn,
  .sidebar,
  .sidebar-overlay,
  .sp-cart-fab{
    display:none!important;
  }

  .app-shell{
    display:block!important;
    width:100%;
    height:100dvh;
    min-height:100dvh;
    overflow:hidden;
    background:var(--sp-bg);
  }

  .app-main.wrap{
    width:100%;
    max-width:100vw;
    height:100dvh;
    min-height:100dvh;
    margin:0;
    padding:10px 8px 76px!important;
    overflow:hidden;
    background:var(--sp-bg);
  }

  #pageProducts{
    height:100%;
    min-height:0;
    overflow:hidden;
  }

  #pageProducts .grid{
    display:block;
    height:100%;
    min-height:0;
  }

  #pageProducts .grid > .card:first-child{
    height:100%;
    min-height:0;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    border:none;
    border-radius:0;
    box-shadow:none;
    background:transparent;
  }

  #pageProducts .grid > .card:first-child > h2{
    flex:0 0 auto;
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:nowrap;
    margin:0;
    padding:0 0 8px!important;
    color:#12213a;
    font-size:18px!important;
    font-weight:1000;
    line-height:1.2;
  }

  #pageProducts .grid > .card:first-child > h2 .pill:first-of-type{
    flex:0 1 auto;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    padding:4px 8px;
    background:#eaf6f7;
    color:var(--sp-teal);
    font-size:10px;
  }

  #pageProducts .grid > .card:first-child > h2 .pill:nth-of-type(2){
    display:none!important;
  }

  #pageProducts .toolbar{
    flex:0 0 auto;
    display:block;
    padding:0!important;
    margin:0 0 8px!important;
  }

  .sp-filter-panel{
    display:block!important;
    width:100%;
    overflow:hidden;
    border:1px solid var(--sp-line);
    border-radius:12px;
    background:#fff;
  }

  .sp-filter-panel summary{
    min-height:42px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 12px;
    list-style:none;
    color:#12213a;
    font-size:13px;
    font-weight:700;
    cursor:pointer;
  }

  .sp-filter-panel summary::-webkit-details-marker{
    display:none;
  }

  .sp-filter-panel summary::after{
    content:"∨";
    font-size:20px;
    line-height:1;
    color:#12213a;
  }

  .sp-filter-body{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:7px;
    padding:8px;
    border-top:1px solid #edf1f7;
  }

  .sp-filter-body #q,
  .sp-filter-body #cat,
  .sp-filter-body .priceFilter,
  .sp-filter-body .stockFilter,
  .sp-filter-body button{
    width:100%!important;
    min-width:0!important;
    flex:none!important;
    grid-column:1/-1;
  }

  .sp-filter-body #q,
  .sp-filter-body #cat,
  .sp-filter-body button{
    height:36px!important;
    padding:7px 10px!important;
    border-radius:10px!important;
    font-size:12px!important;
  }

  .sp-filter-body .priceFilter{
    display:grid!important;
    grid-template-columns:1fr;
    gap:6px!important;
    padding:8px!important;
    border-radius:10px!important;
    white-space:normal!important;
  }

  .sp-filter-body .priceFilter .range{
    display:grid!important;
    grid-template-columns:1fr auto 1fr auto;
    gap:6px!important;
    align-items:center;
  }

  .sp-filter-body .priceFilter input[type="number"]{
    width:100%!important;
    height:34px!important;
    padding:6px 8px!important;
  }

  .sp-filter-body .stockFilter{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:6px!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
  }

  .sp-filter-body .stockFilter label{
    min-height:34px;
    justify-content:center;
    padding:6px 4px;
    border:1px solid var(--sp-line);
    border-radius:10px;
    background:#fff;
    font-size:12px;
    font-weight:800;
  }

  .sp-filter-body .stockFilter input{
    width:16px!important;
    height:16px!important;
  }

  #pageProducts .top-note{
    display:none!important;
  }

  #pageProducts .list{
    flex:1 1 auto;
    min-height:0;
    height:auto;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    border:1px solid var(--sp-line);
    border-radius:12px;
    background:#fff;
    -webkit-overflow-scrolling:touch;
  }

  #pageProducts table,
  #pageProducts thead,
  #pageProducts tbody{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    table-layout:fixed!important;
    border-collapse:collapse!important;
    overflow-x:hidden!important;
  }

  #pageProducts thead{
    position:sticky;
    top:0;
    z-index:20;
    display:table-header-group!important;
    background:#f8fafc;
  }

  #pageProducts thead tr{
    display:grid!important;
    grid-template-columns:46px minmax(0,1fr) 66px 34px 86px;
    align-items:center;
    width:100%;
    border-bottom:1px solid var(--sp-line);
    background:#f8fafc;
  }

  #pageProducts thead th{
    position:static!important;
    display:flex!important;
    align-items:center;
    justify-content:center;
    height:32px!important;
    padding:0 2px!important;
    border:0!important;
    background:#f8fafc!important;
    color:#475569!important;
    font-size:9px!important;
    font-weight:1000!important;
    line-height:1.1;
    white-space:nowrap;
  }

  #pageProducts thead th:nth-child(3),
  #pageProducts tbody td:nth-child(3){
    display:none!important;
  }

  #pageProducts tbody tr{
    display:grid!important;
    grid-template-columns:46px minmax(0,1fr) 66px 34px 86px;
    align-items:center;
    width:100%!important;
    max-width:100%!important;
    min-height:58px;
    padding:7px 4px!important;
    margin:0!important;
    border:0!important;
    border-bottom:1px solid var(--sp-line)!important;
    border-radius:0!important;
    background:#fff!important;
    box-shadow:none!important;
  }

  #pageProducts tbody td{
    display:block!important;
    min-width:0!important;
    padding:0 3px!important;
    border:0!important;
    background:transparent!important;
    overflow:hidden;
  }

  #pageProducts tbody td:nth-child(1){
    text-align:center;
  }

  #pageProducts tbody td:nth-child(2){
    text-align:left;
  }

  #pageProducts tbody td:nth-child(4){
    text-align:right;
    color:#12213a;
    font-size:11px!important;
    font-weight:1000!important;
    white-space:nowrap;
  }

  #pageProducts tbody td:nth-child(5){
    text-align:center;
    color:#12213a;
    font-size:11px!important;
    font-weight:900!important;
    white-space:nowrap;
  }

  #pageProducts tbody td:nth-child(6){
    text-align:right;
    overflow:visible;
  }

  #pageProducts .img{
    width:34px!important;
    height:34px!important;
    border-radius:8px!important;
  }

  #pageProducts td:nth-child(2) > div:first-child{
    display:block;
    max-width:100%;
    overflow:hidden;
    color:#12213a;
    font-size:11px!important;
    font-weight:1000!important;
    line-height:1.25!important;
    white-space:nowrap;
    text-overflow:ellipsis;
  }

  #pageProducts .subinfo{
    margin-top:2px!important;
    overflow:hidden;
    color:#64748b!important;
    font-size:8.5px!important;
    line-height:1.15!important;
    white-space:nowrap;
    text-overflow:ellipsis;
  }

  #pageProducts .cat-badge{
    padding:2px 6px!important;
    font-size:9px!important;
  }

  .qty-stepper{
    display:grid!important;
    grid-template-columns:22px 34px 22px;
    gap:2px!important;
    justify-content:end!important;
    align-items:center!important;
  }

  .qty-step-btn{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:22px!important;
    height:26px!important;
    padding:0!important;
    border:1px solid #d8dfe9!important;
    border-radius:7px!important;
    background:#eef2f7!important;
    color:#334155!important;
    box-shadow:none!important;
    font-size:14px!important;
    font-weight:1000!important;
    line-height:1!important;
  }

  #pageProducts .qty{
    width:34px!important;
    height:26px!important;
    padding:0!important;
    border:1px solid #d8dfe9!important;
    border-radius:7px!important;
    background:#fff!important;
    color:#0f172a!important;
    text-align:center!important;
    font-size:11px!important;
    font-weight:1000!important;
    appearance:textfield!important;
    -moz-appearance:textfield!important;
  }

  #pageProducts .qty::-webkit-outer-spin-button,
  #pageProducts .qty::-webkit-inner-spin-button{
    -webkit-appearance:none!important;
    margin:0!important;
  }

  /* SP カート */
  #spCartBackdrop.sp-cart-backdrop{
    position:fixed!important;
    inset:0!important;
    z-index:2500!important;
    display:block;
    background:rgba(15,23,42,.46)!important;
    backdrop-filter:blur(2px);
  }

  #spCartBackdrop[hidden]{
    display:none!important;
  }

  #pageProducts .grid > .card:nth-child(2){
    display:none!important;
  }

  body.sp-cart-open #pageProducts .grid > .card:nth-child(2){
    position:fixed!important;
    left:14px!important;
    right:14px!important;
    top:56px!important;
    bottom:82px!important;
    z-index:3000!important;
    display:flex!important;
    flex-direction:column!important;
    width:auto!important;
    height:auto!important;
    max-height:none!important;
    overflow:hidden!important;
    border:0!important;
    border-radius:18px!important;
    background:#fff!important;
    box-shadow:0 18px 50px rgba(0,0,0,.28)!important;
  }

  #pageProducts .grid > .card:nth-child(2) h2{
    min-height:44px;
    padding:10px 14px!important;
    display:flex;
    align-items:center;
    justify-content:space-between;
    border-bottom:1px solid var(--sp-line);
    font-size:15px!important;
    font-weight:1000;
  }

  .sp-cart-close{
    width:30px!important;
    height:30px!important;
    padding:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    border-radius:999px!important;
    background:#f1f5f9!important;
    color:#334155!important;
    font-size:18px!important;
    line-height:1!important;
    box-shadow:none!important;
  }

  #pageProducts .cart{
    flex:1;
    min-height:0;
    padding:10px 12px 12px!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
  }

  #pageProducts .cart > .row{
    margin-bottom:7px!important;
  }

  #pageProducts .cart > .row:nth-of-type(1),
  #pageProducts .cart > .row:nth-of-type(2),
  #pageProducts .cart > .row:nth-of-type(3),
  #pageProducts .cart > .row:nth-of-type(4){
    display:block!important;
    width:100%!important;
  }

  #pageProducts .cart select,
  #pageProducts .cart input,
  #pageProducts .cart textarea{
    width:100%!important;
    height:36px!important;
    min-height:36px!important;
    padding:7px 10px!important;
    border-radius:10px!important;
    font-size:12px!important;
  }

  #pageProducts .cart > .row:nth-of-type(5) > div{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    align-items:center!important;
    gap:6px!important;
    width:100%!important;
    min-height:0!important;
    padding:8px!important;
    border-radius:10px!important;
    background:#f8fafc!important;
  }

  #pageProducts .cart > .row:nth-of-type(5) .muted{
    grid-column:1/-1;
    margin:0!important;
    font-size:11px!important;
    line-height:1.1!important;
  }

  #pageProducts .cart > .row:nth-of-type(5) label{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:5px!important;
    min-height:34px!important;
    padding:5px!important;
    border:1px solid var(--sp-line)!important;
    border-radius:9px!important;
    background:#fff!important;
    font-size:12px!important;
    font-weight:900!important;
    white-space:nowrap!important;
  }

  #pageProducts .cart input[type="radio"]{
    width:14px!important;
    height:14px!important;
    min-width:14px!important;
    padding:0!important;
  }

  .cart-line{
    padding:7px 0!important;
    gap:8px!important;
  }

  .cart-name{
    font-size:12px!important;
  }

  .sum-row{
    padding:5px 0!important;
    font-size:12px!important;
  }

  .sum-total{
    padding:10px 12px!important;
    border-radius:10px!important;
    font-size:13px!important;
  }

  #btnOrder{
    height:44px!important;
    min-height:44px!important;
    margin-top:10px!important;
    border-radius:11px!important;
    font-size:14px!important;
  }

  /* SP 下メニュー */
  .sp-bottom-nav{
    position:fixed!important;
    left:0!important;
    right:0!important;
    bottom:0!important;
    z-index:5000!important;
    display:flex!important;
    width:100%!important;
    height:68px!important;
    padding:4px 4px max(4px, env(safe-area-inset-bottom))!important;
    border-top:1px solid var(--sp-line)!important;
    background:#fff!important;
    box-shadow:0 -4px 18px rgba(15,23,42,.08)!important;
  }

  .sp-bottom-nav button{
    position:relative!important;
    flex:1 1 0!important;
    min-width:0!important;
    height:56px!important;
    margin:0!important;
    padding:5px 2px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:3px!important;
    border:0!important;
    border-radius:12px!important;
    background:transparent!important;
    color:#475569!important;
    box-shadow:none!important;
    font-size:10px!important;
    line-height:1.1!important;
    font-weight:900!important;
    white-space:nowrap!important;
  }

  .sp-bottom-nav button.active{
    background:#eaf8f6!important;
    color:#008078!important;
  }

  .sp-bottom-nav .sp-nav-icon{
    width:22px!important;
    height:22px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    color:currentColor!important;
  }

  .sp-bottom-nav svg{
    width:21px!important;
    height:21px!important;
    display:block!important;
    stroke:currentColor!important;
  }

  .sp-bottom-cart-badge{
    position:absolute!important;
    top:2px!important;
    right:calc(50% - 22px)!important;
    min-width:16px!important;
    height:16px!important;
    padding:0 4px!important;
    border:2px solid #fff!important;
    border-radius:999px!important;
    background:#e11d48!important;
    color:#fff!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    font-size:9px!important;
    font-weight:1000!important;
    line-height:1!important;
  }

  .sp-bottom-cart-badge.is-empty{
    display:none!important;
  }

  /* SP その他ページ */
  #pageOrders,
  #pageDashboard,
  #pageAccount,
  #pageMaster,
  #pageSettings{
    height:100%;
    overflow:auto;
  }

  .orders-card,
  .dashboard-card,
  #pageAccount .page-card,
  #pageSettings .page-card{
    height:auto!important;
    min-height:calc(100dvh - 86px)!important;
    padding:14px!important;
    overflow:visible!important;
  }

  .dashboard-kpis,
  .dashboard-grid{
    grid-template-columns:1fr!important;
  }

  .orders-toolbar,
  .dashboard-toolbar,
  .page-head,
  .orders-head,
  .dashboard-head,
  .account-list-head,
  .master-list-head{
    flex-direction:column;
    align-items:stretch;
  }


  .orders-card{
    display:flex!important;
    flex-direction:column!important;
    min-height:calc(100dvh - 86px)!important;
  }

  .orders-table-wrap{
    flex:1 1 auto!important;
    min-height:360px!important;
    max-height:calc(100dvh - 280px)!important;
    overflow:auto!important;
  }

  .orders-search,
  .orders-toolbar input,
  .orders-toolbar select,
  .orders-toolbar button,
  .dashboard-toolbar select,
  .dashboard-toolbar button{
    width:100%!important;
  }

  .account-page-form,
  .master-form{
    grid-template-columns:1fr!important;
  }

  .master-page-grid{
    display:block!important;
    height:auto!important;
  }

  .master-form-card,
  .master-list-card{
    height:auto!important;
    margin-bottom:12px!important;
  }
}

@media (max-width:370px){
  #pageProducts thead tr,
  #pageProducts tbody tr{
    grid-template-columns:42px minmax(0,1fr) 60px 30px 78px;
  }

  .qty-stepper{
    grid-template-columns:20px 30px 20px;
  }

  .qty-step-btn{
    width:20px!important;
    height:24px!important;
  }

  #pageProducts .qty{
    width:30px!important;
    height:24px!important;
  }
}




/* =====================================================
   SP FONT WEIGHT LIGHT FIX
===================================================== */
@media (max-width:980px){

  body{
    font-weight:350!important;
    -webkit-font-smoothing:antialiased;
  }

  /* 見出し */
  h1,h2,h3,h4,h5,h6,
  .card h2,
  .page-head h2,
  .dashboard-head h2,
  .orders-head h2,
  .master-head h2{
    font-weight:600!important;
    letter-spacing:0!important;
  }

  /* 商品名 */
  .name,
  .cart-name,
  .account-name-text{
    font-weight:500!important;
  }

  /* サブ */
  .sub,
  .subinfo,
  .muted,
  .top-note{
    font-weight:350!important;
  }

  /* ボタン */
  button,
  .btn-primary,
  .folder-link,
  .logout-btn,
  .master-order-btn,
  .account-save-order-btn{
    font-weight:500!important;
  }

  /* 下メニュー */
  .sp-bottom-nav a{
    font-weight:450!important;
  }

  /* フィルター */
  .sp-filter-panel summary,
  .stockFilter label{
    font-weight:500!important;
  }

  /* 数量 */
  .sp-qty-btn,
  .sp-qty-input,
  .qty{
    font-weight:500!important;
  }

  /* 合計 */
  .sum-total,
  .sum-total .label,
  .sum-total .value,
  .order-amount{
    font-weight:600!important;
  }

  /* バッジ */
  .pill,
  .cat-badge,
  .role-badge,
  .order-status-badge{
    font-weight:500!important;
  }

  /* テーブル */
  th{
    font-weight:500!important;
  }

  td{
    font-weight:350!important;
  }

  /* サイドナビ */
  .nav a{
    font-weight:500!important;
  }

  /* ログイン */
  .login-brand{
    font-weight:600!important;
  }

  .login-label{
    font-weight:500!important;
  }

  /* モーダル */
  .om-value,
  .om-orderNo{
    font-weight:600!important;
  }

  .om-label{
    font-weight:450!important;
  }
}



@media (max-width:980px){

  /* 全体を軽く */
  body{
    font-weight:400!important;
    -webkit-font-smoothing:antialiased!important;
    text-rendering:optimizeLegibility;
  }

  /* 商品名 */
  #pageProducts .name{
    font-weight:500!important;
    letter-spacing:-0.01em!important;
    color:#24324a!important;
  }

  /* サブ情報 */
  #pageProducts .sub,
  #pageProducts .subinfo{
    font-weight:400!important;
    color:#7b8498!important;
  }

  /* 金額 */
  #pageProducts td:nth-child(4){
    font-weight:600!important;
    color:#24324a!important;
    letter-spacing:-0.01em!important;
  }

  /* 在庫 */
  #pageProducts td:nth-child(5){
    font-weight:500!important;
    color:#475569!important;
  }

  /* 数量入力 */
  .sp-qty-input,
  .qty{
    font-weight:500!important;
    color:#24324a!important;
  }

  /* 数量ボタン */
  .sp-qty-btn{
    font-weight:500!important;
  }

  /* ヘッダー */
  #pageProducts th{
    font-weight:500!important;
    color:#64748b!important;
  }

  /* 下メニュー */
  .sp-bottom-nav a{
    font-weight:400!important;
  }
}



/* =========================================================
   PC 2列カード表示 + カートポップアップ
========================================================= */
@media (min-width:981px){

  body{
    background:#f4f7fb!important;
  }

  body:not(.is-authenticated) .pc-cart-float{
    display:none!important;
  }

  .pc-cart-float{
    position:fixed!important;
    top:18px!important;
    right:22px!important;
    z-index:2400!important;
    width:48px!important;
    height:48px!important;
    padding:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    border:0!important;
    border-radius:16px!important;
    background:linear-gradient(135deg,#0b555b,#087f7b)!important;
    color:#fff!important;
    box-shadow:0 14px 32px rgba(15,119,120,.28)!important;
  }

  .pc-cart-badge{
    position:absolute!important;
    top:-7px!important;
    right:-7px!important;
    min-width:22px!important;
    height:22px!important;
    padding:0 6px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    border:2px solid #fff!important;
    border-radius:999px!important;
    background:#e11d48!important;
    color:#fff!important;
    font-size:12px!important;
    font-weight:700!important;
    line-height:1!important;
  }

  .pc-cart-badge.is-empty{
    display:none!important;
  }

  .app-main.wrap{
    padding:16px 76px 16px 16px!important;
  }

  #pageProducts .grid{
    display:block!important;
    height:calc(100vh - 32px)!important;
  }

  #pageProducts .grid > .card:first-child{
    height:100%!important;
    display:flex!important;
    flex-direction:column!important;
    border-radius:18px!important;
    border:1px solid #e7edf5!important;
    box-shadow:0 8px 28px rgba(15,23,42,.05)!important;
    overflow:hidden!important;
  }

  #pageProducts .grid > .card:nth-child(2){
    display:none!important;
  }

  body.pc-cart-open #pageProducts .grid > .card:nth-child(2){
    position:fixed!important;
    top:82px!important;
    right:28px!important;
    bottom:28px!important;
    z-index:3000!important;
    width:460px!important;
    max-width:calc(100vw - 56px)!important;
    height:auto!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
    border:1px solid #e7edf5!important;
    border-radius:20px!important;
    background:#fff!important;
    box-shadow:0 28px 80px rgba(15,23,42,.26)!important;
  }

  body.pc-cart-open #spCartBackdrop{
    display:block!important;
  }

  #pageProducts .grid > .card:nth-child(2) > h2{
    min-height:56px!important;
    padding:16px 18px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    border-bottom:1px solid #eef2f7!important;
    font-size:20px!important;
    font-weight:700!important;
  }

  #pageProducts .grid > .card:nth-child(2) .sp-cart-close{
    width:32px!important;
    height:32px!important;
    padding:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    border-radius:999px!important;
    background:#f1f5f9!important;
    color:#334155!important;
    box-shadow:none!important;
    font-size:18px!important;
  }

  #pageProducts .cart{
    padding:16px 18px 18px!important;
  }

  /* PCでも絞り込み項目を表示 */
  #pageProducts .toolbar{
    display:block!important;
    padding:0 20px 12px!important;
  }

  #pageProducts .toolbar > :not(.sp-filter-panel){
    display:none!important;
  }

  .sp-filter-panel{
    display:block!important;
    width:100%!important;
    margin:0!important;
    border:1px solid #e2e8f0!important;
    border-radius:14px!important;
    background:#fff!important;
    overflow:hidden!important;
    box-shadow:none!important;
  }

  .sp-filter-panel summary{
    min-height:48px!important;
    padding:0 16px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    color:#334155!important;
    list-style:none!important;
    font-size:15px!important;
    font-weight:600!important;
    cursor:pointer!important;
  }

  .sp-filter-panel summary::-webkit-details-marker{
    display:none!important;
  }

  .sp-filter-panel summary::after{
    content:"⌄";
    color:#64748b;
    font-size:20px;
  }

  .sp-filter-panel[open] summary::after{
    transform:rotate(180deg);
  }

  .sp-filter-body{
    display:grid!important;
    grid-template-columns:minmax(280px,1fr) 180px minmax(360px,.85fr) 220px 92px!important;
    gap:10px!important;
    padding:12px!important;
    border-top:1px solid #eef2f7!important;
    background:#fbfdff!important;
  }

  .sp-filter-body #q,
  .sp-filter-body #cat,
  .sp-filter-body .priceFilter,
  .sp-filter-body .stockFilter,
  .sp-filter-body button{
    width:100%!important;
    min-width:0!important;
    height:42px!important;
    box-sizing:border-box!important;
  }

  .sp-filter-body #q,
  .sp-filter-body #cat{
    padding:9px 12px!important;
    border-radius:12px!important;
    font-size:14px!important;
  }

  .sp-filter-body .priceFilter{
    display:flex!important;
    align-items:center!important;
    gap:8px!important;
    padding:5px 10px!important;
    border-radius:12px!important;
    background:#fff!important;
    white-space:nowrap!important;
  }

  .sp-filter-body .priceFilter .range{
    display:flex!important;
    align-items:center!important;
    gap:6px!important;
  }

  .sp-filter-body .priceFilter input[type="number"]{
    width:86px!important;
    height:32px!important;
    padding:6px 8px!important;
  }

  .sp-filter-body .stockFilter{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    align-items:center!important;
    gap:6px!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
  }

  .sp-filter-body .stockFilter label{
    height:42px!important;
    justify-content:center!important;
    padding:0 8px!important;
    border:1px solid #d8dbe6!important;
    border-radius:12px!important;
    background:#fff!important;
    font-size:13px!important;
    font-weight:500!important;
  }

  .sp-filter-body button{
    border-radius:12px!important;
    font-weight:600!important;
  }

  #pageProducts .card > h2{
    padding:18px 20px 10px!important;
    font-size:24px!important;
    font-weight:700!important;
    letter-spacing:-.02em!important;
  }

  #pageProducts .top-note{
    padding:0 20px 8px!important;
  }

  /* 商品一覧を2列カード化 */
  #pageProducts .list{
    flex:1!important;
    min-height:0!important;
    padding:14px!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    border-top:1px solid #eef2f7!important;
    background:#f8fafc!important;
  }

  #pageProducts table,
  #pageProducts tbody,
  #pageProducts tr,
  #pageProducts td{
    display:block!important;
    width:auto!important;
  }

  #pageProducts table{
    table-layout:auto!important;
    border-collapse:separate!important;
  }

  #pageProducts thead{
    display:none!important;
  }

  #pageProducts tbody{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(360px,1fr))!important;
    gap:12px!important;
  }

  #pageProducts tbody tr{
    min-width:0!important;
    display:grid!important;
    grid-template-columns:70px minmax(0,1fr) 132px!important;
    grid-template-rows:auto auto auto!important;
    gap:7px 14px!important;
    align-items:center!important;
    padding:14px!important;
    border:1px solid #e5eaf2!important;
    border-radius:16px!important;
    background:#fff!important;
    box-shadow:0 3px 12px rgba(15,23,42,.035)!important;
    transition:transform .14s ease, box-shadow .14s ease, border-color .14s ease!important;
  }

  #pageProducts tbody tr:hover{
    transform:translateY(-1px)!important;
    border-color:#d6e0ec!important;
    box-shadow:0 12px 28px rgba(15,23,42,.07)!important;
  }

  #pageProducts tbody td{
    padding:0!important;
    border:0!important;
    background:transparent!important;
    min-width:0!important;
    overflow:visible!important;
  }

  #pageProducts tbody td:nth-child(1){
    grid-column:1!important;
    grid-row:1 / span 3!important;
    align-self:start!important;
  }

  #pageProducts tbody td:nth-child(2){
    grid-column:2!important;
    grid-row:1!important;
    overflow:hidden!important;
  }

  #pageProducts tbody td:nth-child(3){
    grid-column:2!important;
    grid-row:2!important;
    text-align:left!important;
  }

  #pageProducts tbody td:nth-child(4){
    grid-column:3!important;
    grid-row:1!important;
    align-self:start!important;
    text-align:right!important;
    font-size:18px!important;
    font-weight:650!important;
    color:#0f172a!important;
    letter-spacing:-.02em!important;
  }

  #pageProducts tbody td:nth-child(5){
    grid-column:2!important;
    grid-row:3!important;
    text-align:left!important;
    color:#64748b!important;
    font-size:13px!important;
    font-weight:500!important;
  }

  #pageProducts tbody td:nth-child(5)::before{
    content:"在庫 ";
    color:#64748b;
  }

  #pageProducts tbody td:nth-child(6){
    grid-column:3!important;
    grid-row:2 / span 2!important;
    align-self:end!important;
    justify-self:end!important;
  }

  #pageProducts .img{
    width:70px!important;
    height:70px!important;
    border-radius:14px!important;
    border:1px solid #e7edf5!important;
    object-fit:cover!important;
  }

  #pageProducts td:nth-child(2) > div:first-child{
    display:block!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:15px!important;
    font-weight:600!important;
    line-height:1.35!important;
    color:#10233f!important;
  }

  #pageProducts .subinfo{
    margin-top:4px!important;
    font-size:12px!important;
    font-weight:400!important;
    color:#64748b!important;
    line-height:1.25!important;
  }

  #pageProducts .cat-badge{
    padding:4px 9px!important;
    font-size:11px!important;
    font-weight:600!important;
  }

  #pageProducts .qty-stepper{
    display:grid!important;
    grid-template-columns:34px 50px 34px!important;
    gap:5px!important;
    align-items:center!important;
    justify-content:end!important;
  }

  #pageProducts .qty-step-btn{
    width:34px!important;
    height:34px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    padding:0!important;
    border:1px solid #d8dfe9!important;
    border-radius:10px!important;
    background:#f1f5f9!important;
    color:#24324a!important;
    box-shadow:none!important;
    font-size:18px!important;
    font-weight:600!important;
  }

  #pageProducts .qty{
    width:50px!important;
    height:34px!important;
    padding:0!important;
    border:1px solid #d8dfe9!important;
    border-radius:10px!important;
    text-align:center!important;
    font-size:14px!important;
    font-weight:600!important;
    appearance:textfield!important;
    -moz-appearance:textfield!important;
  }

  #pageProducts .qty::-webkit-outer-spin-button,
  #pageProducts .qty::-webkit-inner-spin-button{
    -webkit-appearance:none!important;
    margin:0!important;
  }
}

@media (min-width:981px) and (max-width:1360px){
  #pageProducts tbody{
    grid-template-columns:1fr!important;
  }

  .sp-filter-body{
    grid-template-columns:1fr 180px!important;
  }

  .sp-filter-body .priceFilter,
  .sp-filter-body .stockFilter,
  .sp-filter-body button{
    grid-column:auto!important;
  }
}



@media (min-width:981px){

  /* 商品一覧を3列カード表示 */
  #pageProducts tbody{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:14px!important;
  }

  #pageProducts tbody tr{
    display:grid!important;
    grid-template-columns:96px minmax(0,1fr) 96px!important;
    grid-template-rows:auto auto auto!important;
    min-height:150px!important;
    padding:16px!important;
    gap:8px 14px!important;
  }

  /* 画像を大きく */
  #pageProducts td:nth-child(1){
    grid-column:1!important;
    grid-row:1 / span 3!important;
    align-self:start!important;
  }

  #pageProducts .img{
    width:88px!important;
    height:88px!important;
    border-radius:14px!important;
  }

  /* 商品名まわりを大きく */
  #pageProducts td:nth-child(2){
    grid-column:2!important;
    grid-row:1!important;
  }

  #pageProducts td:nth-child(2) > div:first-child{
    font-size:16px!important;
    font-weight:600!important;
    line-height:1.35!important;
  }

  #pageProducts .subinfo{
    font-size:12px!important;
    margin-top:4px!important;
  }

  /* カテゴリ */
  #pageProducts td:nth-child(3){
    grid-column:2!important;
    grid-row:2!important;
  }

  .cat-badge{
    font-size:11px!important;
    padding:5px 10px!important;
  }

  /* 金額を画像の下へ */
  #pageProducts td:nth-child(4){
    grid-column:1!important;
    grid-row:4!important;
    text-align:center!important;
    font-size:18px!important;
    font-weight:700!important;
    color:#0f172a!important;
    margin-top:6px!important;
  }

  /* 在庫 */
  #pageProducts td:nth-child(5){
    grid-column:2!important;
    grid-row:3!important;
    font-size:13px!important;
    color:#475569!important;
  }

  #pageProducts td:nth-child(5)::before{
    content:"在庫 ";
  }

  /* 数量 */
  #pageProducts td:nth-child(6){
    grid-column:3!important;
    grid-row:1 / span 4!important;
    align-self:end!important;
    justify-self:end!important;
  }

  .qty-stepper{
    gap:6px!important;
  }

  .qty-step-btn{
    display:flex!important;
    width:34px!important;
    height:34px!important;
  }

  #pageProducts .qty{
    width:46px!important;
    height:34px!important;
  }
}



@media (min-width:981px){

  /* =========================================
     カートをサイドバー下部へ
  ========================================= */

  .pc-cart-float{
    position:fixed!important;
    left:18px!important;
    bottom:22px!important;
    top:auto!important;
    right:auto!important;

    width:120px!important;
    height:64px!important;

    border-radius:18px!important;

    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:10px!important;

    background:linear-gradient(135deg,#0f7778,#0a5c5d)!important;
    color:#fff!important;

    box-shadow:
      0 10px 30px rgba(0,0,0,.24),
      inset 0 1px 0 rgba(255,255,255,.12)!important;
  }

  .pc-cart-float svg{
    width:30px!important;
    height:30px!important;
  }

  .pc-cart-float::after{
    content:"カート";
    font-size:16px;
    font-weight:600;
    letter-spacing:.02em;
  }

  .pc-cart-badge{
    top:-8px!important;
    right:-8px!important;

    min-width:28px!important;
    height:28px!important;

    font-size:13px!important;
    font-weight:700!important;
  }

  /* =========================================
     商品一覧 3列
  ========================================= */

  #pageProducts tbody{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:22px!important;
  }

  /* =========================================
     商品カード 全体大型化
  ========================================= */

  #pageProducts tbody tr{

    display:grid!important;

    grid-template-columns:
      150px
      minmax(0,1fr)
      150px!important;

    grid-template-rows:
      auto
      auto
      auto
      auto!important;

    min-height:270px!important;

    padding:26px!important;

    gap:16px 22px!important;

    border-radius:24px!important;

    border:1px solid #e5eaf2!important;

    background:#fff!important;

    box-shadow:
      0 6px 24px rgba(15,23,42,.05)!important;

    transition:
      transform .14s ease,
      box-shadow .14s ease!important;
  }

  #pageProducts tbody tr:hover{
    transform:translateY(-2px);
    box-shadow:
      0 18px 44px rgba(15,23,42,.1)!important;
  }

  /* =========================================
     画像
  ========================================= */

  #pageProducts td:nth-child(1){
    grid-column:1!important;
    grid-row:1 / span 3!important;
    align-self:start!important;
  }

  #pageProducts .img,
  #pageProducts .thumb{
    width:138px!important;
    height:138px!important;

    border-radius:20px!important;

    border:1px solid #edf2f7!important;

    background:#fff!important;
  }

  /* =========================================
     商品情報
  ========================================= */

  #pageProducts td:nth-child(2){
    grid-column:2!important;
    grid-row:1!important;
    min-width:0!important;
  }

  #pageProducts .name{
    font-size:28px!important;
    line-height:1.35!important;
    font-weight:600!important;
    letter-spacing:-0.02em!important;
    color:#0f172a!important;
  }

  #pageProducts .subinfo,
  #pageProducts .sub{
    margin-top:8px!important;

    font-size:18px!important;

    line-height:1.5!important;

    color:#64748b!important;
  }

  /* =========================================
     カテゴリ
  ========================================= */

  #pageProducts td:nth-child(3){
    grid-column:2!important;
    grid-row:2!important;
  }

  .cat-badge{
    font-size:16px!important;
    font-weight:600!important;

    padding:
      8px
      16px!important;

    border-radius:999px!important;
  }

  /* =========================================
     金額
  ========================================= */

  #pageProducts td:nth-child(4){

    grid-column:1!important;
    grid-row:4!important;

    margin-top:10px!important;

    text-align:center!important;

    font-size:34px!important;

    line-height:1!important;

    font-weight:700!important;

    color:#0f172a!important;

    letter-spacing:-0.03em!important;
  }

  /* =========================================
     在庫
  ========================================= */

  #pageProducts td:nth-child(5){

    grid-column:2!important;
    grid-row:3!important;

    font-size:20px!important;

    font-weight:500!important;

    color:#475569!important;
  }

  #pageProducts td:nth-child(5)::before{
    content:"在庫 ";
  }

  /* =========================================
     数量
  ========================================= */

  #pageProducts td:nth-child(6){

    grid-column:3!important;
    grid-row:1 / span 4!important;

    align-self:end!important;
    justify-self:end!important;
  }

  .qty-stepper{
    gap:12px!important;
  }

  .qty-step-btn{

    width:56px!important;
    height:56px!important;

    border-radius:16px!important;

    font-size:32px!important;

    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
  }

  #pageProducts .qty{

    width:82px!important;
    height:56px!important;

    border-radius:16px!important;

    font-size:26px!important;

    font-weight:600!important;
  }

  /* =========================================
     カード余白
  ========================================= */

  #pageProducts .list{
    padding:22px!important;
  }

  /* =========================================
     スクロールバー
  ========================================= */

  #pageProducts .list::-webkit-scrollbar{
    width:12px;
  }

  #pageProducts .list::-webkit-scrollbar-thumb{
    background:#cbd5e1;
    border-radius:999px;
  }
}



/* =========================================================
   PC FINAL UI: 6列カード + サイドバー内カート + 中央カートモーダル
   2026-05 clean override
========================================================= */
@media (min-width:981px){

  body{
    background:#f4f7fb!important;
  }

  .app-main.wrap{
    padding:16px!important;
  }

  #pageProducts .grid{
    display:block!important;
    height:calc(100vh - 32px)!important;
  }

  #pageProducts .grid > .card:first-child{
    height:100%!important;
    border:1px solid #e6edf5!important;
    border-radius:18px!important;
    box-shadow:0 8px 28px rgba(15,23,42,.05)!important;
    overflow:hidden!important;
  }

  /* 通常時はカートカードを非表示 */
  #pageProducts .grid > .card:nth-child(2){
    display:none!important;
  }

  /* カートは中央ポップアップ */
  body.pc-cart-open #spCartBackdrop{
    display:block!important;
  }

  body.pc-cart-open #pageProducts .grid > .card:nth-child(2){
    position:fixed!important;
    top:50%!important;
    left:50%!important;
    right:auto!important;
    bottom:auto!important;
    transform:translate(-50%,-50%)!important;
    z-index:3000!important;
    display:flex!important;
    flex-direction:column!important;
    width:min(560px,calc(100vw - 64px))!important;
    max-height:calc(100vh - 80px)!important;
    height:auto!important;
    overflow:hidden!important;
    border:1px solid #e6edf5!important;
    border-radius:22px!important;
    background:#fff!important;
    box-shadow:0 30px 90px rgba(15,23,42,.28)!important;
  }

  #pageProducts .grid > .card:nth-child(2) > h2{
    min-height:58px!important;
    padding:16px 20px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    border-bottom:1px solid #eef2f7!important;
    font-size:20px!important;
    font-weight:650!important;
  }

  #pageProducts .grid > .card:nth-child(2) .sp-cart-close{
    width:34px!important;
    height:34px!important;
    padding:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    border-radius:999px!important;
    background:#f1f5f9!important;
    color:#334155!important;
    box-shadow:none!important;
    font-size:18px!important;
  }

  #pageProducts .cart{
    padding:18px 20px 20px!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
  }

  /* サイドバー下部カート */
  .pc-cart-float{
    display:none!important;
  }

  .pc-sidebar-cart{
    width:100%!important;
    min-height:74px!important;
    margin-top:auto!important;
    margin-bottom:14px!important;
    padding:12px 14px!important;
    border:1px solid rgba(255,255,255,.18)!important;
    border-radius:16px!important;
    background:rgba(255,255,255,.10)!important;
    color:#fff!important;
    box-shadow:none!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:10px!important;
    text-align:left!important;
    backdrop-filter:blur(10px);
  }

  body:not(.is-authenticated) .pc-sidebar-cart{
    display:none!important;
  }

  .pc-sidebar-cart:hover{
    background:rgba(255,255,255,.15)!important;
    border-color:rgba(255,255,255,.32)!important;
  }

  .pc-sidebar-cart-main{
    display:flex;
    align-items:center;
    gap:12px;
    min-width:0;
  }

  .pc-sidebar-cart-icon{
    width:38px;
    height:38px;
    flex:0 0 38px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:12px;
    background:rgba(255,255,255,.14);
  }

  .pc-sidebar-cart-icon svg{
    width:23px!important;
    height:23px!important;
  }

  .pc-sidebar-cart-label{
    display:block;
    font-size:14px;
    font-weight:600;
    line-height:1.2;
  }

  .pc-sidebar-cart-total{
    display:block;
    margin-top:3px;
    font-size:18px;
    font-weight:700;
    letter-spacing:-.02em;
    line-height:1.15;
  }

  .pc-cart-badge{
    position:static!important;
    min-width:24px!important;
    height:24px!important;
    padding:0 7px!important;
    border:2px solid rgba(255,255,255,.92)!important;
    border-radius:999px!important;
    background:#e11d48!important;
    color:#fff!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    font-size:12px!important;
    font-weight:700!important;
    line-height:1!important;
  }

  .pc-cart-badge.is-empty{
    display:none!important;
  }

  .account-box{
    margin-top:0!important;
  }

  /* 絞り込みはPCでも表示 */
  #pageProducts .toolbar{
    display:block!important;
    padding:0 20px 12px!important;
  }

  #pageProducts .toolbar > :not(.sp-filter-panel){
    display:none!important;
  }

  .sp-filter-panel{
    display:block!important;
    width:100%!important;
    margin:0!important;
    border:1px solid #e2e8f0!important;
    border-radius:14px!important;
    background:#fff!important;
    overflow:hidden!important;
    box-shadow:none!important;
  }

  .sp-filter-panel summary{
    min-height:48px!important;
    padding:0 16px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    color:#334155!important;
    list-style:none!important;
    font-size:15px!important;
    font-weight:600!important;
    cursor:pointer!important;
  }

  .sp-filter-panel summary::-webkit-details-marker{
    display:none!important;
  }

  .sp-filter-panel summary::after{
    content:"⌄";
    color:#64748b;
    font-size:20px;
  }

  .sp-filter-panel[open] summary::after{
    transform:rotate(180deg);
  }

  .sp-filter-body{
    display:grid!important;
    grid-template-columns:minmax(240px,1fr) 170px minmax(320px,.75fr) 210px 90px!important;
    gap:10px!important;
    padding:12px!important;
    border-top:1px solid #eef2f7!important;
    background:#fbfdff!important;
  }

  .sp-filter-body #q,
  .sp-filter-body #cat,
  .sp-filter-body .priceFilter,
  .sp-filter-body .stockFilter,
  .sp-filter-body button{
    width:100%!important;
    min-width:0!important;
    height:42px!important;
    box-sizing:border-box!important;
  }

  .sp-filter-body #q,
  .sp-filter-body #cat{
    padding:9px 12px!important;
    border-radius:12px!important;
    font-size:14px!important;
  }

  .sp-filter-body .priceFilter{
    display:flex!important;
    align-items:center!important;
    gap:8px!important;
    padding:5px 10px!important;
    border-radius:12px!important;
    background:#fff!important;
    white-space:nowrap!important;
  }

  .sp-filter-body .priceFilter .range{
    display:flex!important;
    align-items:center!important;
    gap:6px!important;
  }

  .sp-filter-body .priceFilter input[type="number"]{
    width:82px!important;
    height:32px!important;
    padding:6px 8px!important;
  }

  .sp-filter-body .stockFilter{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    align-items:center!important;
    gap:6px!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
  }

  .sp-filter-body .stockFilter label{
    height:42px!important;
    justify-content:center!important;
    padding:0 8px!important;
    border:1px solid #d8dbe6!important;
    border-radius:12px!important;
    background:#fff!important;
    font-size:13px!important;
    font-weight:500!important;
  }

  .sp-filter-body button{
    border-radius:12px!important;
    font-weight:600!important;
  }

  #pageProducts .card > h2{
    padding:18px 20px 10px!important;
    font-size:24px!important;
    font-weight:700!important;
    letter-spacing:-.02em!important;
  }

  #pageProducts .top-note{
    padding:0 20px 8px!important;
  }

  /* 6列グリッド商品カード */
  #pageProducts .list{
    flex:1!important;
    min-height:0!important;
    padding:16px!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    border-top:1px solid #eef2f7!important;
    background:#f8fafc!important;
  }

  #pageProducts table,
  #pageProducts tbody,
  #pageProducts tr,
  #pageProducts td{
    display:block!important;
    width:auto!important;
  }

  #pageProducts table{
    table-layout:auto!important;
    border-collapse:separate!important;
  }

  #pageProducts thead{
    display:none!important;
  }

  #pageProducts tbody{
    display:grid!important;
    grid-template-columns:repeat(6,minmax(150px,1fr))!important;
    gap:14px!important;
  }

  #pageProducts tbody tr{
    min-width:0!important;
    min-height:270px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:flex-start!important;
    gap:7px!important;
    padding:16px 12px!important;
    border:1px solid #e5eaf2!important;
    border-radius:18px!important;
    background:#fff!important;
    box-shadow:0 2px 8px rgba(15,23,42,.025)!important;
    transition:border-color .14s ease, background .14s ease!important;
  }

  #pageProducts tbody tr:hover{
    transform:none!important;
    box-shadow:0 2px 8px rgba(15,23,42,.025)!important;
    border-color:#2f6f73!important;
    background:#fbfefe!important;
  }

  #pageProducts tbody td{
    padding:0!important;
    border:0!important;
    background:transparent!important;
    min-width:0!important;
    overflow:visible!important;
    text-align:center!important;
  }

  #pageProducts tbody td:nth-child(1){
    order:1!important;
  }

  #pageProducts tbody td:nth-child(2){
    order:2!important;
    width:100%!important;
    overflow:hidden!important;
  }

  #pageProducts tbody td:nth-child(3){
    order:3!important;
  }

  #pageProducts tbody td:nth-child(4){
    order:4!important;
    margin-top:2px!important;
    font-size:21px!important;
    line-height:1.15!important;
    font-weight:650!important;
    color:#0f172a!important;
    letter-spacing:-.03em!important;
  }

  #pageProducts tbody td:nth-child(6){
    order:5!important;
    width:100%!important;
    margin-top:4px!important;
  }

  #pageProducts tbody td:nth-child(5){
    order:6!important;
    margin-top:0!important;
    color:#475569!important;
    font-size:13px!important;
    font-weight:500!important;
  }

  #pageProducts tbody td:nth-child(5)::before{
    content:"在庫 ";
    color:#64748b;
  }

  #pageProducts .img,
  #pageProducts .thumb{
    width:96px!important;
    height:96px!important;
    border-radius:16px!important;
    border:1px solid #e7edf5!important;
    object-fit:cover!important;
    background:#fff!important;
  }

  #pageProducts td:nth-child(2) > div:first-child,
  #pageProducts .name{
    display:block!important;
    width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:15px!important;
    font-weight:600!important;
    line-height:1.35!important;
    color:#10233f!important;
  }

  #pageProducts .subinfo,
  #pageProducts .sub{
    margin-top:4px!important;
    font-size:12px!important;
    font-weight:400!important;
    color:#64748b!important;
    line-height:1.25!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  #pageProducts .cat-badge{
    padding:4px 10px!important;
    font-size:11px!important;
    font-weight:600!important;
  }

  #pageProducts .qty-stepper{
    display:grid!important;
    grid-template-columns:34px 48px 34px!important;
    gap:5px!important;
    align-items:center!important;
    justify-content:center!important;
  }

  #pageProducts .qty-step-btn{
    width:34px!important;
    height:34px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    padding:0!important;
    border:1px solid #d8dfe9!important;
    border-radius:10px!important;
    background:#f1f5f9!important;
    color:#24324a!important;
    box-shadow:none!important;
    font-size:18px!important;
    font-weight:600!important;
  }

  #pageProducts .qty-step-btn:hover{
    border-color:#2f6f73!important;
    background:#f3fbfb!important;
  }

  #pageProducts .qty{
    width:48px!important;
    height:34px!important;
    padding:0!important;
    border:1px solid #d8dfe9!important;
    border-radius:10px!important;
    text-align:center!important;
    font-size:14px!important;
    font-weight:600!important;
    appearance:textfield!important;
    -moz-appearance:textfield!important;
  }

  #pageProducts .qty::-webkit-outer-spin-button,
  #pageProducts .qty::-webkit-inner-spin-button{
    -webkit-appearance:none!important;
    margin:0!important;
  }

  #pageProducts .list::-webkit-scrollbar{
    width:12px;
  }

  #pageProducts .list::-webkit-scrollbar-thumb{
    background:#cbd5e1;
    border-radius:999px;
  }
}

@media (min-width:981px) and (max-width:1680px){
  #pageProducts tbody{
    grid-template-columns:repeat(5,minmax(150px,1fr))!important;
  }
}

@media (min-width:981px) and (max-width:1420px){
  #pageProducts tbody{
    grid-template-columns:repeat(4,minmax(150px,1fr))!important;
  }

  .sp-filter-body{
    grid-template-columns:1fr 170px!important;
  }

  .sp-filter-body .priceFilter,
  .sp-filter-body .stockFilter,
  .sp-filter-body button{
    grid-column:auto!important;
  }
}



/* =========================================================
   PC FINAL PRODUCT GRID TUNING
   - 最大10列の可変グリッド
   - 商品画像2倍・枠線なし
   - 画像/金額/数量を中央揃え
   - カート表示時は背景をぼかす
========================================================= */
@media (min-width:981px){

  /* カート表示時の背景ぼかし */
  body.pc-cart-open #spCartBackdrop{
    display:block!important;
    background:rgba(248,250,252,.58)!important;
    backdrop-filter:blur(9px)!important;
    -webkit-backdrop-filter:blur(9px)!important;
  }

  body.pc-cart-open #pageProducts .grid > .card:nth-child(2){
    top:50%!important;
    left:50%!important;
    right:auto!important;
    bottom:auto!important;
    transform:translate(-50%,-50%)!important;
    width:min(560px,calc(100vw - 72px))!important;
    max-height:calc(100vh - 88px)!important;
    border-radius:22px!important;
    box-shadow:0 32px 90px rgba(15,23,42,.28)!important;
  }

  /* 商品一覧エリア */
  #pageProducts .list{
    padding:14px!important;
    background:#f8fafc!important;
  }

  #pageProducts table,
  #pageProducts tbody,
  #pageProducts tr,
  #pageProducts td{
    display:block!important;
  }

  #pageProducts thead{
    display:none!important;
  }

  /* 基本は画面幅に合わせる。超ワイドでも最大10列 */
  #pageProducts tbody{
    display:grid!important;
    grid-template-columns:repeat(auto-fit,minmax(156px,1fr))!important;
    gap:12px!important;
    align-items:stretch!important;
  }

  @media (min-width:1900px){
    #pageProducts tbody{
      grid-template-columns:repeat(10,minmax(0,1fr))!important;
    }
  }

  @media (min-width:1700px) and (max-width:1899px){
    #pageProducts tbody{
      grid-template-columns:repeat(9,minmax(0,1fr))!important;
    }
  }

  @media (min-width:1500px) and (max-width:1699px){
    #pageProducts tbody{
      grid-template-columns:repeat(8,minmax(0,1fr))!important;
    }
  }

  @media (min-width:1300px) and (max-width:1499px){
    #pageProducts tbody{
      grid-template-columns:repeat(6,minmax(0,1fr))!important;
    }
  }

  @media (min-width:981px) and (max-width:1299px){
    #pageProducts tbody{
      grid-template-columns:repeat(4,minmax(0,1fr))!important;
    }
  }

  /* カードUI */
  #pageProducts tbody tr{
    min-width:0!important;
    min-height:286px!important;
    height:auto!important;
    padding:14px 10px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:flex-start!important;
    gap:0!important;
    border:1px solid #e6edf5!important;
    border-radius:18px!important;
    background:#fff!important;
    box-shadow:none!important;
    transition:border-color .14s ease, background-color .14s ease!important;
  }

  #pageProducts tbody tr:hover{
    transform:none!important;
    box-shadow:none!important;
    border-color:#2f6f73!important;
    background:#fbffff!important;
  }

  #pageProducts tbody td{
    width:100%!important;
    min-width:0!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
    text-align:center!important;
    overflow:visible!important;
  }

  /* 画像：枠線なし・中央 */
  #pageProducts tbody td:nth-child(1){
    order:1!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    min-height:118px!important;
    margin-bottom:8px!important;
  }

  #pageProducts .img,
  #pageProducts .thumb{
    width:112px!important;
    height:112px!important;
    max-width:112px!important;
    max-height:112px!important;
    border:none!important;
    outline:none!important;
    box-shadow:none!important;
    border-radius:0!important;
    object-fit:contain!important;
    background:transparent!important;
  }

  /* 商品名 */
  #pageProducts tbody td:nth-child(2){
    order:2!important;
    display:block!important;
    margin-bottom:4px!important;
  }

  #pageProducts td:nth-child(2) > div:first-child,
  #pageProducts .name{
    display:block!important;
    max-width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    color:#10233f!important;
    font-size:15px!important;
    line-height:1.35!important;
    font-weight:600!important;
    letter-spacing:-.01em!important;
    text-align:center!important;
  }

  #pageProducts .subinfo,
  #pageProducts .sub{
    margin-top:4px!important;
    color:#64748b!important;
    font-size:12px!important;
    font-weight:400!important;
    line-height:1.35!important;
    text-align:center!important;
  }

  /* カテゴリ */
  #pageProducts tbody td:nth-child(3){
    order:3!important;
    margin:5px 0 8px!important;
  }

  #pageProducts .cat-badge{
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    padding:4px 10px!important;
    border-radius:999px!important;
    font-size:11px!important;
    font-weight:500!important;
  }

  /* 金額：画像下〜数量上で中央 */
  #pageProducts tbody td:nth-child(4){
    order:4!important;
    margin-top:auto!important;
    margin-bottom:8px!important;
    color:#0f172a!important;
    font-size:18px!important;
    line-height:1.1!important;
    font-weight:650!important;
    letter-spacing:-.02em!important;
    text-align:center!important;
  }

  /* 数量：金額の下 */
  #pageProducts tbody td:nth-child(6){
    order:5!important;
    margin-bottom:8px!important;
    display:flex!important;
    justify-content:center!important;
    align-items:center!important;
  }

  #pageProducts .qty-stepper{
    display:grid!important;
    grid-template-columns:28px 42px 28px!important;
    gap:5px!important;
    justify-content:center!important;
    align-items:center!important;
  }

  #pageProducts .qty-step-btn{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:28px!important;
    height:30px!important;
    padding:0!important;
    border:1px solid #dbe3ee!important;
    border-radius:9px!important;
    background:#f3f7fb!important;
    color:#24324a!important;
    box-shadow:none!important;
    font-size:17px!important;
    font-weight:500!important;
    line-height:1!important;
  }

  #pageProducts .qty{
    width:42px!important;
    height:30px!important;
    padding:0!important;
    border:1px solid #dbe3ee!important;
    border-radius:9px!important;
    background:#fff!important;
    color:#10233f!important;
    text-align:center!important;
    font-size:14px!important;
    font-weight:500!important;
    appearance:textfield!important;
    -moz-appearance:textfield!important;
  }

  #pageProducts .qty::-webkit-outer-spin-button,
  #pageProducts .qty::-webkit-inner-spin-button{
    -webkit-appearance:none!important;
    margin:0!important;
  }

  /* 在庫：最下部中央 */
  #pageProducts tbody td:nth-child(5){
    order:6!important;
    color:#475569!important;
    font-size:12px!important;
    font-weight:500!important;
    line-height:1.2!important;
    text-align:center!important;
  }

  #pageProducts tbody td:nth-child(5)::before{
    content:"在庫 "!important;
    color:#475569!important;
  }

  /* 売切表示 */
  #pageProducts .sold{
    color:#e11d48!important;
    font-weight:600!important;
  }

  /* サイドバー内カートは維持 */
  .pc-cart-float{
    display:none!important;
  }

  .pc-sidebar-cart{
    display:flex!important;
  }
}



/* =========================================================
   Final UI adjustments
   - カテゴリバッジ中央揃え
   - 売切時は「売切」のみ表示
   - カート表示時は背景を暗く＋ぼかし
   - サイドカート再クリックで閉じられるように前面化
========================================================= */
@media (min-width:981px){
  /* サイドバー上のカートを背景オーバーレイより前面に */
  .sidebar{
    z-index:3200!important;
  }

  .pc-sidebar-cart,
  .pc-cart-float{
    position:relative!important;
    z-index:3600!important;
  }

  /* カート表示時の背景 */
  body.pc-cart-open #spCartBackdrop{
    display:block!important;
    position:fixed!important;
    inset:0!important;
    z-index:2500!important;
    background:rgba(15,23,42,.58)!important;
    backdrop-filter:blur(7px)!important;
    -webkit-backdrop-filter:blur(7px)!important;
  }

  body.pc-cart-open #pageProducts .grid > .card:first-child,
  body.pc-cart-open .app-main.wrap > section:not(#pageProducts){
    filter:blur(2px)!important;
  }

  /* ポップアップは中央表示 */
  body.pc-cart-open #pageProducts .grid > .card:nth-child(2){
    position:fixed!important;
    left:50%!important;
    top:50%!important;
    right:auto!important;
    bottom:auto!important;
    transform:translate(-50%,-50%)!important;
    width:min(560px,calc(100vw - 56px))!important;
    max-height:calc(100vh - 72px)!important;
    z-index:3400!important;
    border-radius:22px!important;
    box-shadow:0 30px 90px rgba(15,23,42,.34)!important;
  }

  /* カテゴリバッジ中央揃え */
  #pageProducts tbody td:nth-child(3){
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:100%!important;
    text-align:center!important;
  }

  #pageProducts .cat-badge{
    margin-left:auto!important;
    margin-right:auto!important;
    text-align:center!important;
    justify-content:center!important;
  }

  /* 売切時は「在庫」を付けない */
  #pageProducts tbody td:nth-child(5):has(.sold)::before{
    content:""!important;
  }

  #pageProducts tbody td:nth-child(5) .sold{
    display:inline-block!important;
  }
}

@media (max-width:980px){
  body.sp-cart-open #spCartBackdrop{
    background:rgba(15,23,42,.58)!important;
    backdrop-filter:blur(7px)!important;
    -webkit-backdrop-filter:blur(7px)!important;
  }

  #pageProducts tbody td:nth-child(5):has(.sold)::before{
    content:""!important;
  }
}



/* =========================================================
   Login prefill + Order detail modal refined UI
========================================================= */
body.order-detail-open #appShell,
body.order-detail-open #pcCartFloat{
  filter:blur(4px);
  transition:filter .18s ease;
}

#orderHistoryModal.om-backdrop{
  background:rgba(2,6,23,.68)!important;
  backdrop-filter:blur(8px)!important;
  -webkit-backdrop-filter:blur(8px)!important;
  padding:28px!important;
}

#orderHistoryModal .order-detail-card{
  width:min(1080px, calc(100vw - 56px))!important;
  max-height:calc(100vh - 56px)!important;
  overflow:hidden!important;
  display:flex!important;
  flex-direction:column!important;
  border:1px solid rgba(226,232,240,.9)!important;
  border-radius:24px!important;
  background:#fff!important;
  box-shadow:0 32px 96px rgba(15,23,42,.34)!important;
  padding:0!important;
}

#orderHistoryModal .order-detail-card > h2{
  margin:0!important;
  padding:20px 24px!important;
  border-bottom:1px solid #eef2f7!important;
  color:#0f172a!important;
  font-size:22px!important;
  font-weight:650!important;
  letter-spacing:-.02em!important;
  background:linear-gradient(180deg,#fff,#fbfdff)!important;
}

#orderHistoryModal .order-detail-grid{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:10px!important;
  margin:0!important;
  padding:18px 24px!important;
  background:#f8fafc!important;
  border-bottom:1px solid #eef2f7!important;
}

#orderHistoryModal .order-detail-field{
  border:1px solid #e6edf5!important;
  border-radius:16px!important;
  background:#fff!important;
  padding:12px 14px!important;
  box-shadow:0 1px 2px rgba(15,23,42,.03)!important;
}

#orderHistoryModal .order-detail-label{
  margin:0 0 6px!important;
  color:#64748b!important;
  font-size:11px!important;
  font-weight:600!important;
  letter-spacing:.03em!important;
}

#orderHistoryModal .order-detail-value{
  color:#0f172a!important;
  font-size:14px!important;
  font-weight:550!important;
  line-height:1.45!important;
}

#orderHistoryModal .order-detail-note{
  grid-column:1 / -1!important;
}

#orderHistoryModal #odTotal{
  color:#0f7778!important;
  font-size:18px!important;
  font-weight:700!important;
}

#orderHistoryModal .order-status-badge{
  font-size:12px!important;
  font-weight:600!important;
  padding:5px 10px!important;
}

#orderHistoryModal .order-detail-table-wrap{
  flex:1!important;
  min-height:0!important;
  overflow:auto!important;
  margin:0!important;
  border:0!important;
  border-radius:0!important;
  padding:0 24px 18px!important;
  background:#fff!important;
}

#orderHistoryModal .order-detail-table{
  width:100%!important;
  min-width:760px!important;
  border-collapse:separate!important;
  border-spacing:0!important;
  table-layout:fixed!important;
}

#orderHistoryModal .order-detail-table th{
  position:sticky!important;
  top:0!important;
  z-index:2!important;
  height:42px!important;
  padding:0 12px!important;
  border-top:0!important;
  border-bottom:1px solid #e6edf5!important;
  background:#fff!important;
  color:#64748b!important;
  font-size:12px!important;
  font-weight:600!important;
  text-align:left!important;
}

#orderHistoryModal .order-detail-table td{
  padding:13px 12px!important;
  border-top:0!important;
  border-bottom:1px solid #f1f5f9!important;
  color:#334155!important;
  font-size:13px!important;
  font-weight:400!important;
  vertical-align:middle!important;
}

#orderHistoryModal .order-detail-table td:nth-child(3),
#orderHistoryModal .order-detail-table td:nth-child(4),
#orderHistoryModal .order-detail-table td:nth-child(5),
#orderHistoryModal .order-detail-table td:nth-child(6),
#orderHistoryModal .order-detail-table th:nth-child(3),
#orderHistoryModal .order-detail-table th:nth-child(4),
#orderHistoryModal .order-detail-table th:nth-child(5),
#orderHistoryModal .order-detail-table th:nth-child(6){
  text-align:right!important;
}

#orderHistoryModal .order-detail-table td strong{
  font-weight:600!important;
  color:#0f172a!important;
}

#orderHistoryModal .order-detail-actions{
  margin:0!important;
  padding:16px 24px!important;
  display:flex!important;
  justify-content:flex-end!important;
  border-top:1px solid #eef2f7!important;
  background:#fbfdff!important;
}

#orderHistoryModal .order-detail-actions button{
  min-width:120px!important;
  height:42px!important;
  border-radius:12px!important;
  font-weight:600!important;
}

@media (max-width:980px){
  body.order-detail-open #appShell,
  body.order-detail-open #pcCartFloat{
    filter:none!important;
  }

  #orderHistoryModal.om-backdrop{
    padding:14px!important;
  }

  #orderHistoryModal .order-detail-card{
    width:100%!important;
    max-height:calc(100dvh - 28px)!important;
    border-radius:18px!important;
  }

  #orderHistoryModal .order-detail-card > h2{
    padding:14px 16px!important;
    font-size:18px!important;
  }

  #orderHistoryModal .order-detail-grid{
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
    padding:12px!important;
  }

  #orderHistoryModal .order-detail-note{
    grid-column:1 / -1!important;
  }

  #orderHistoryModal .order-detail-table-wrap{
    padding:0 12px 12px!important;
  }

  #orderHistoryModal .order-detail-actions{
    padding:12px!important;
  }

  #orderHistoryModal .order-detail-actions button{
    width:100%!important;
  }
}



/* =========================================================
   v7 SP改善
   - カート内訳を縦スクロールで確認
   - 注文履歴を横スクロールなしのカード表示へ変更
========================================================= */
@media (max-width:980px){

  /* SPカート：入力欄・内訳・合計・ボタンを縦に収める */
  body.sp-cart-open #pageProducts .grid > .card:nth-child(2){
    top:46px!important;
    bottom:76px!important;
    max-height:calc(100dvh - 122px)!important;
    overflow:hidden!important;
  }

  body.sp-cart-open #pageProducts .grid > .card:nth-child(2) > h2{
    flex:0 0 auto!important;
  }

  #pageProducts .cart{
    flex:1 1 auto!important;
    min-height:0!important;
    display:flex!important;
    flex-direction:column!important;
    gap:7px!important;
    overflow:hidden!important;
    padding:9px 12px 12px!important;
  }

  #pageProducts .cart > .row{
    flex:0 0 auto!important;
    margin-bottom:0!important;
  }

  #pageProducts .cart-lines{
    flex:1 1 auto!important;
    min-height:96px!important;
    max-height:none!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    margin-top:2px!important;
    padding:2px 4px 2px 0!important;
    -webkit-overflow-scrolling:touch!important;
    border-top:1px solid #eef2f7!important;
    border-bottom:1px solid #eef2f7!important;
  }

  #pageProducts .cart-line{
    align-items:flex-start!important;
    padding:8px 0!important;
  }

  #pageProducts .cart-line > div:first-child{
    min-width:0!important;
  }

  #pageProducts .cart-name{
    line-height:1.35!important;
    white-space:normal!important;
    word-break:break-word!important;
  }

  #pageProducts .sum{
    flex:0 0 auto!important;
    margin-top:0!important;
    padding-top:2px!important;
  }

  #pageProducts .sum-row{
    padding:3px 0!important;
  }

  #pageProducts .sum-total{
    margin-top:4px!important;
    padding:9px 10px!important;
  }

  #pageProducts #btnOrder,
  #pageProducts #btnClearCart{
    min-height:40px!important;
    height:40px!important;
    margin-top:0!important;
  }

  /* SP注文履歴：テーブルをカード化して横スクロールをなくす */
  #pageOrders{
    overflow:hidden!important;
  }

  #pageOrders .orders-card{
    height:calc(100dvh - 86px)!important;
    min-height:0!important;
    overflow:hidden!important;
    display:flex!important;
    flex-direction:column!important;
  }

  #pageOrders .orders-head,
  #pageOrders .orders-toolbar{
    flex:0 0 auto!important;
  }

  #pageOrders .orders-toolbar .left{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
    width:100%!important;
  }

  #pageOrders .orders-toolbar .right{
    width:100%!important;
    text-align:left!important;
  }

  #pageOrders .orders-table-wrap{
    flex:1 1 auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    -webkit-overflow-scrolling:touch!important;
  }

  #pageOrders .orders-table{
    width:100%!important;
    min-width:0!important;
    table-layout:auto!important;
    border-collapse:separate!important;
    border-spacing:0 10px!important;
  }

  #pageOrders .orders-table thead{
    display:none!important;
  }

  #pageOrders .orders-table tbody{
    display:block!important;
    width:100%!important;
  }

  #pageOrders .orders-table tbody tr{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    gap:6px 10px!important;
    width:100%!important;
    margin:0 0 10px!important;
    padding:12px!important;
    border:1px solid #e5eaf2!important;
    border-radius:14px!important;
    background:#fff!important;
    box-shadow:0 6px 18px rgba(15,23,42,.04)!important;
  }

  #pageOrders .orders-table tbody td{
    display:flex!important;
    align-items:flex-start!important;
    justify-content:space-between!important;
    gap:8px!important;
    min-width:0!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
    color:#1f2a44!important;
    font-size:12px!important;
    line-height:1.35!important;
    word-break:break-word!important;
    overflow:visible!important;
    text-align:right!important;
  }

  #pageOrders .orders-table tbody td::before{
    content:"";
    flex:0 0 auto!important;
    color:#64748b!important;
    font-size:11px!important;
    font-weight:600!important;
    text-align:left!important;
    white-space:nowrap!important;
  }

  #pageOrders .orders-table tbody td:nth-child(1)::before{ content:"注文日"; }
  #pageOrders .orders-table tbody td:nth-child(2)::before{ content:"注文番号"; }
  #pageOrders .orders-table tbody td:nth-child(3)::before{ content:"請求先"; }
  #pageOrders .orders-table tbody td:nth-child(4)::before{ content:"店舗名"; }
  #pageOrders .orders-table tbody td:nth-child(5)::before{ content:"発注者"; }
  #pageOrders .orders-table tbody td:nth-child(6)::before{ content:"数量"; }
  #pageOrders .orders-table tbody td:nth-child(7)::before{ content:"注文額"; }
  #pageOrders .orders-table tbody td:nth-child(8)::before{ content:"ステータス"; }

  #pageOrders .orders-table tbody td:nth-child(2),
  #pageOrders .orders-table tbody td:nth-child(3),
  #pageOrders .orders-table tbody td:nth-child(4){
    grid-column:1 / -1!important;
  }

  #pageOrders .orders-table tbody td:nth-child(2){
    padding-bottom:4px!important;
    border-bottom:1px dashed #edf2f7!important;
  }

  #pageOrders .orders-table tbody td:nth-child(2) strong{
    font-size:13px!important;
    color:#0f555b!important;
  }

  #pageOrders .orders-table .order-amount{
    font-weight:700!important;
    color:#0f172a!important;
  }

  #pageOrders .orders-table .order-status-badge{
    white-space:nowrap!important;
    font-size:11px!important;
    padding:4px 8px!important;
  }

  #pageOrders .orders-table tbody tr td[colspan]{
    grid-column:1 / -1!important;
    display:block!important;
    text-align:center!important;
    padding:18px!important;
  }

  #pageOrders .orders-table tbody tr td[colspan]::before{
    content:none!important;
  }
}



/* =========================================================
   2026-05-25 FIX: SPカート縦スクロール + 内訳表示
========================================================= */
@media (max-width:980px){
  body.sp-cart-open #pageProducts .grid > .card:nth-child(2){
    top:46px!important;
    bottom:76px!important;
    max-height:calc(100dvh - 122px)!important;
    overflow:hidden!important;
  }

  body.sp-cart-open #pageProducts .cart{
    flex:1 1 auto!important;
    min-height:0!important;
    display:block!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    padding:10px 12px 14px!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior:contain!important;
  }

  body.sp-cart-open #pageProducts .cart-lines{
    max-height:none!important;
    min-height:auto!important;
    overflow:visible!important;
    margin-top:8px!important;
    padding:0!important;
    border-top:1px solid #eef2f7!important;
    border-bottom:1px solid #eef2f7!important;
  }

  body.sp-cart-open #pageProducts .sum{
    margin-top:8px!important;
  }

  body.sp-cart-open #pageProducts textarea#note{
    min-height:76px!important;
  }
}



@media (max-width:980px){

  .order-detail-modal,
  #orderDetailModal,
  #orderHistoryModal{
    overflow:hidden!important;
  }

  .order-detail-card{
    height:calc(100dvh - 24px)!important;
    max-height:calc(100dvh - 24px)!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
  }

  .order-detail-body,
  .order-detail-content{
    flex:1 1 auto!important;
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    padding-bottom:16px!important;
  }

  .order-detail-table-wrap{
    max-height:none!important;
    min-height:180px!important;
    overflow-y:auto!important;
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch!important;
    margin-bottom:14px!important;
  }

  .order-detail-table{
    min-width:720px!important;
  }

  .order-detail-table th,
  .order-detail-table td{
    white-space:normal!important;
    word-break:break-word!important;
  }

  .order-detail-actions{
    flex:0 0 auto!important;
    position:sticky!important;
    bottom:0!important;
    z-index:5!important;
    padding-top:10px!important;
    background:#fff!important;
  }
}



/* =========================================================
   CSS Refactor Patch
   対象：注文詳細モーダル / SP下メニュー / スクロール制御
   方針：!importantは [hidden] のみに限定

   使い方：
   1. 既存の「注文履歴｜注文詳細 UI改善版 PC/SP」以降の後付けCSSを削除
   2. 既存CSSの最後にこのCSSを1回だけ追加
   3. 同じセレクタを後ろで再定義しない
========================================================= */

/* =========================================================
   01. Base safety
========================================================= */
[hidden]{
  display:none !important;
}

html,
body{
  overscroll-behavior-x:none;
}

body.order-detail-open{
  overflow:hidden;
}

/* =========================================================
   02. Modal common
========================================================= */
.om-backdrop{
  position:fixed;
  inset:0;
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:rgba(15,23,42,.55);
  backdrop-filter:blur(4px);
}

/* =========================================================
   03. Order detail modal - PC
========================================================= */
#orderHistoryModal{
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}

#orderHistoryModal .order-detail-card{
  width:min(980px,100%);
  max-height:calc(100dvh - 48px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  border:1px solid #e6edf5;
  border-radius:24px;
  background:#fff;
  box-shadow:0 24px 70px rgba(15,23,42,.28);
}

#orderHistoryModal .order-detail-card > h2{
  flex:0 0 auto;
  margin:0;
  padding:22px 28px;
  border-bottom:1px solid #eef2f7;
  color:#0f172a;
  font-size:22px;
  font-weight:800;
  line-height:1.3;
}

#orderHistoryModal .order-detail-grid{
  flex:0 0 auto;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  padding:22px 28px 18px;
  background:linear-gradient(180deg,#f8fafc,#fff);
}

#orderHistoryModal .order-detail-field{
  min-height:86px;
  padding:15px 16px;
  border:1px solid #e4eaf2;
  border-radius:16px;
  background:#fff;
  box-shadow:0 8px 18px rgba(15,23,42,.04);
}

#orderHistoryModal .order-detail-note{
  grid-column:1 / -1;
  min-height:72px;
}

#orderHistoryModal .order-detail-label{
  margin-bottom:8px;
  color:#64748b;
  font-size:12px;
  font-weight:700;
}

#orderHistoryModal .order-detail-value{
  color:#0f172a;
  font-size:15px;
  font-weight:700;
  line-height:1.45;
  word-break:break-word;
}

#orderHistoryModal #odTotal{
  color:#0f7778;
  font-size:22px;
  font-weight:900;
}

#orderHistoryModal .order-status-badge{
  padding:5px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
}

#orderHistoryModal .order-detail-table-wrap{
  flex:1 1 auto;
  min-height:0;
  margin:0 28px;
  overflow:auto;
  border:1px solid #e6edf5;
  border-radius:18px;
  background:#fff;
  -webkit-overflow-scrolling:touch;
}

#orderHistoryModal .order-detail-table{
  width:100%;
  min-width:760px;
  border-collapse:separate;
  border-spacing:0;
  table-layout:fixed;
}

#orderHistoryModal .order-detail-table th{
  position:sticky;
  top:0;
  z-index:2;
  padding:13px 14px;
  border:0;
  border-bottom:1px solid #e6edf5;
  background:#f8fafc;
  color:#64748b;
  font-size:12px;
  font-weight:800;
  text-align:left;
}

#orderHistoryModal .order-detail-table td{
  padding:15px 14px;
  border:0;
  border-bottom:1px solid #f1f5f9;
  color:#334155;
  font-size:13px;
  line-height:1.45;
  vertical-align:middle;
}

#orderHistoryModal .order-detail-table tbody tr:hover td{
  background:#f8fbfb;
}

#orderHistoryModal .order-detail-table th:first-child,
#orderHistoryModal .order-detail-table td:first-child{
  width:34%;
}

#orderHistoryModal .order-detail-table td:first-child{
  color:#0f172a;
  font-weight:700;
  white-space:normal;
  word-break:break-word;
}

#orderHistoryModal .order-detail-table th:nth-child(n+3),
#orderHistoryModal .order-detail-table td:nth-child(n+3){
  text-align:right;
}

#orderHistoryModal .order-detail-actions{
  flex:0 0 auto;
  display:flex;
  justify-content:flex-end;
  gap:12px;
  margin:0;
  padding:18px 28px 22px;
  border-top:1px solid #eef2f7;
  background:#fbfdff;
}

#orderHistoryModal .order-detail-actions button{
  min-width:150px;
  height:46px;
  border-radius:14px;
  font-size:14px;
  font-weight:800;
}

/* =========================================================
   04. SP bottom navigation
========================================================= */
.sp-bottom-nav{
  touch-action:manipulation;
  overscroll-behavior:none;
  user-select:none;
  -webkit-user-select:none;
}

.sp-bottom-nav button{
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}

/* =========================================================
   05. Order detail modal - SP
   ポップアップ全体を縦スクロール可能にする
========================================================= */
@media (max-width:980px){

  body.order-detail-open{
    overflow:hidden;
  }

  #orderHistoryModal.om-backdrop{
    align-items:flex-start;
    justify-content:center;
    padding:10px;
    overflow-y:auto;
    overflow-x:hidden;
  }

  #orderHistoryModal .order-detail-card{
    width:100%;
    max-height:none;
    display:block;
    overflow:visible;
    border-radius:22px;
    margin-bottom:20px;
  }

  #orderHistoryModal .order-detail-card > h2{
    position:sticky;
    top:0;
    z-index:3;
    padding:18px;
    background:#fff;
    font-size:20px;
  }

  #orderHistoryModal .order-detail-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
    padding:16px;
    overflow:visible;
    background:#f8fafc;
  }

  #orderHistoryModal .order-detail-field{
    min-height:82px;
    padding:13px;
    border-radius:15px;
  }

  #orderHistoryModal .order-detail-label{
    font-size:11px;
  }

  #orderHistoryModal .order-detail-value{
    font-size:14px;
  }

  #orderHistoryModal #odTotal{
    font-size:21px;
  }

  #orderHistoryModal .order-detail-note{
    grid-column:1 / -1;
  }

  #orderHistoryModal .order-detail-table-wrap{
    min-height:auto;
    margin:0 12px 12px;
    overflow:visible;
    border:0;
    border-radius:0;
    background:#f8fafc;
  }

  #orderHistoryModal .order-detail-table,
  #orderHistoryModal .order-detail-table thead,
  #orderHistoryModal .order-detail-table tbody,
  #orderHistoryModal .order-detail-table tr,
  #orderHistoryModal .order-detail-table th,
  #orderHistoryModal .order-detail-table td{
    display:block;
    width:100%;
    min-width:0;
  }

  #orderHistoryModal .order-detail-table thead{
    display:none;
  }

  #orderHistoryModal .order-detail-table tbody tr{
    margin:0 0 10px;
    padding:14px;
    border:1px solid #e6edf5;
    border-radius:18px;
    background:#fff;
    box-shadow:0 8px 18px rgba(15,23,42,.05);
  }

  #orderHistoryModal .order-detail-table td{
    display:grid;
    grid-template-columns:86px minmax(0,1fr);
    gap:10px;
    align-items:start;
    padding:7px 0;
    border:0;
    background:transparent;
    text-align:left;
    font-size:13px;
    white-space:normal !important;
  }

  #orderHistoryModal .order-detail-table td::before{
    color:#64748b;
    font-size:11px;
    font-weight:800;
  }

  #orderHistoryModal .order-detail-table td:nth-child(1)::before{ content:"商品名"; }
  #orderHistoryModal .order-detail-table td:nth-child(2)::before{ content:"カテゴリ"; }
  #orderHistoryModal .order-detail-table td:nth-child(3)::before{ content:"数量"; }
  #orderHistoryModal .order-detail-table td:nth-child(4)::before{ content:"単価"; }
  #orderHistoryModal .order-detail-table td:nth-child(5)::before{ content:"Pack単価"; }
  #orderHistoryModal .order-detail-table td:nth-child(6)::before{ content:"小計"; }

  #orderHistoryModal .order-detail-table td:first-child{
    padding-top:0;
    color:#0f172a;
    font-size:14px;
    font-weight:800;
    line-height:1.45;
    white-space:normal;
    word-break:break-word;
  }

  #orderHistoryModal .order-detail-table td:nth-child(n+3){
    text-align:left;
  }

  #orderHistoryModal .order-detail-actions{
    position:sticky;
    bottom:0;
    z-index:3;
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
    padding:12px;
    background:#fff;
    box-shadow:0 -10px 24px rgba(15,23,42,.06);
  }

  #orderHistoryModal .order-detail-actions button{
    width:100%;
    min-width:0;
    height:48px;
    border-radius:15px;
  }
}

/* 注文詳細モーダル全体スクロール化 */
#orderHistoryModal .order-detail-card {
  display: block !important;
  overflow-y: auto !important;
}
#orderHistoryModal .order-detail-table-wrap {
  overflow: visible !important;
  flex: none !important;
  min-height: auto !important;
  margin-bottom: 20px !important;
}

/* ダッシュボードとアカウント管理の縦スクロール化 */
.dashboard-card,
.page-card {
  overflow-y: auto !important;
}

/* 商品マスタツールバーのレイアウト調整 */
.master-toolbar {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
}
.master-toolbar button,
.master-toolbar label {
  margin: 0 !important;
}

/* activeバッジのワンクリック切替対応 */
.active-toggle-btn {
  cursor: pointer !important;
  user-select: none !important;
  transition: opacity 0.15s !important;
}
.active-toggle-btn:hover {
  opacity: 0.8 !important;
}
.master-badge-active {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
}

/* PC表示におけるSP用ログアウトボタンの非表示化 */
.sp-logout-section {
  display: none !important;
}

/* お知らせメッセージ表示エリアのスタイル */
#topMessagesArea .pill {
  background: #f0f9fa !important;
  color: #007799 !important;
  font-weight: 500 !important;
  border-radius: 9999px !important;
  font-size: 13px !important;
  border: none !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 6px 16px !important;
}

/* SP表示時における各種スタイル上書き */
@media (max-width: 980px) {
  .sp-logout-section {
    display: block !important;
  }
  
  .sp-bottom-nav button[data-sp-nav="settings"].active {
    color: var(--sp-teal) !important;
  }
}

/* =========================================================
   追加機能・バグ修正用スタイル (第4弾)
   ========================================================= */

/* 受注状況件数バッジ */
.badge-count {
  background-color: #ef4444 !important;
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  min-width: 20px !important;
  height: 20px !important;
  padding: 0 5px !important;
  border-radius: 9999px !important;
  line-height: 1 !important;
  margin-left: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle !important;
}

/* 納品書作成フォーム用 */
.invoice-form-grid input,
.invoice-form-grid select,
.invoice-form-grid textarea {
  width: 100% !important;
  padding: 8px 12px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  font-size: 14px !important;
}
.invoice-form-grid select {
  background-position: right 10px center !important;
}
#pageCreateInvoice h3 {
  font-size: 16px !important;
  font-weight: bold !important;
  color: #0f7778 !important;
  border-left: 4px solid #0f7778 !important;
  padding-left: 8px !important;
}

/* SPでの注文詳細ポップアップはみ出しの完全修正 */
@media (max-width: 980px) {
  .order-detail-card {
    width: 95% !important;
    max-width: 100% !important;
    padding: 16px !important;
    margin: 10px auto !important;
    overflow-y: auto !important;
  }
  #orderHistoryModal .order-detail-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  #orderHistoryModal .order-detail-field.order-detail-note {
    grid-column: span 2 !important;
  }
  #orderHistoryModal .order-detail-table-wrap {
    overflow-x: auto !important;
    width: 100% !important;
    margin-top: 12px !important;
    border: 1px solid var(--bd) !important;
    border-radius: 8px !important;
    -webkit-overflow-scrolling: touch !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
  }
  #orderHistoryModal .order-detail-table {
    min-width: 100% !important;
    table-layout: auto !important;
  }
  #orderHistoryModal .order-detail-table th,
  #orderHistoryModal .order-detail-table td {
    padding: 8px 6px !important;
    font-size: 11px !important;
    width: 100% !important;
  }
}

/* =========================================================
   06. Product Detail Popup Modal
========================================================= */
#productDetailModal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#productDetailModal:not([hidden]) {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.product-detail-popup-card {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#productDetailModal:not([hidden]) .product-detail-popup-card {
  transform: scale(1);
}

.close-popup-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  color: #64748b;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s ease, color 0.2s ease;
}

.close-popup-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.product-popup-content {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  padding: 32px;
  overflow-y: auto;
}

.product-popup-image-wrap {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-popup-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-popup-info {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* スマホ表示向けのレスポンシブ調整 */
@media (max-width: 640px) {
  #productDetailModal {
    padding: 12px;
  }
  
  .product-detail-popup-card {
    max-height: calc(100dvh - 24px);
    border-radius: 20px;
  }

  .product-popup-content {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 24px 16px 16px 16px;
  }

  .product-popup-image-wrap {
    max-width: 200px;
    margin: 0 auto;
  }

  .close-popup-btn {
    top: 12px;
    right: 12px;
  }
}

/* =========================================================
   リクエスト（チャット）機能
========================================================= */

.request-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.request-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border-color: #cbd5e1;
}

.request-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
  padding-right: 12px;
}

.request-title {
  font-size: 15px;
  font-weight: bold;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.request-meta {
  font-size: 12px;
  color: #64748b;
}

.request-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.request-status-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-unread { background: #fee2e2; color: #b91c1c; }
.status-unread::before { background: #ef4444; }

.status-unhandled { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.status-unhandled::before { background: #f59e0b; }

.status-handling { background: #f0f9ff; color: #0284c7; border: 1px solid #bae6fd; }
.status-handling::before { background: #0ea5e9; }

.status-handled { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.status-handled::before { background: #22c55e; }

.status-rejected { background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; }
.status-rejected::before { background: #94a3b8; }

/* チャットバブル */
.chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}

.chat-bubble-wrap.me {
  align-items: flex-end;
}

.chat-bubble-wrap.other {
  align-items: flex-start;
}

.chat-bubble-sender {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
  margin-left: 4px;
  margin-right: 4px;
}

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-bubble.me {
  background: #0f7778;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.other {
  background: #fff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.chat-bubble-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  margin-left: 4px;
  margin-right: 4px;
}
