:root{
  /* base color: 水色 (sky blue). marketplace colors & danger stay unchanged */
  --primary:#0ea5e9; --primary-dark:#0284c7; --danger:#e5534b; --warn:#e0a800;
  --ink:#1f2937; --muted:#6b7280; --line:#e5e7eb; --bg:#f5f6f8; --card:#fff;
}
*{box-sizing:border-box}
body{margin:0;font-family:-apple-system,"Hiragino Kaku Gothic ProN",Meiryo,sans-serif;color:var(--ink);background:var(--bg)}
.login-page{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;background:var(--bg)}
.login-card{width:min(420px,100%);background:#fff;border:1px solid var(--line);border-radius:10px;
  box-shadow:0 8px 24px rgba(15,23,42,.10);padding:28px}
.login-card h1{text-align:center;margin:4px 0 22px;font-size:22px}
.login-card label{display:block;margin:0 0 14px;font-size:13px;color:var(--muted)}
.login-card input{display:block;margin-top:5px;height:40px;color:var(--ink)}
.login-logo{display:block;width:92px;height:auto;margin:0 auto 8px}
.login-error{color:var(--danger);font-size:13px;margin:0 0 12px}
.login-button{width:100%;height:40px}
.login-recovery{display:block;text-align:center;margin-top:16px;color:var(--primary-dark);font-size:12px}
/* App is exactly viewport height; ONLY .main scrolls. This makes the pinned
   header physically fixed (it is the first, flush-top child of the scroller),
   so it does not move a single pixel on scroll. */
html,body{height:100%}
.layout{display:flex;height:100vh;overflow:hidden}
.aside{width:210px;background:#0369a1;color:#fff;flex-shrink:0;height:100vh;overflow-y:auto}
.aside .brand{padding:16px;font-weight:700;font-size:18px;border-bottom:1px solid rgba(255,255,255,.15)}
.aside a{display:block;padding:11px 16px;color:#e0f2fe;text-decoration:none;cursor:pointer;font-size:14px}
.aside a:hover,.aside a.active{background:rgba(255,255,255,.14)}
.aside .err-badge{margin:10px;padding:8px;background:#7f1d1d;border-radius:6px;font-size:12px}
.main{flex:1;height:100vh;overflow-y:auto;padding:0}
/* pinned header (title + filters/controls) — never moves */
.page-head{position:sticky;top:0;z-index:40;background:var(--bg);
  padding:14px 22px 12px;border-bottom:1px solid var(--line)}
.page-head h1{margin:0 0 10px}
.inventory-title-row{display:flex;align-items:center;gap:18px;margin-bottom:10px}
.inventory-title-row h1{margin:0}
.inventory-summary{display:flex;align-items:center;gap:18px;border:1px solid var(--line);
  border-radius:6px;background:#fff;padding:6px 12px;color:var(--muted);font-size:12px;white-space:nowrap}
.inventory-summary strong{color:var(--text);font-size:14px;margin-left:4px}
.page-body{padding:16px 22px 60px}
h1{font-size:20px;margin:0 0 14px}
.section{background:var(--card);border:1px solid var(--line);border-radius:8px;padding:14px;margin-bottom:14px}
.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.grow{flex:1;min-width:120px}
input,select,textarea,button{font:inherit}
input,select,textarea{padding:7px 9px;border:1px solid var(--line);border-radius:6px;width:100%}
button{padding:7px 12px;border:0;border-radius:6px;background:#e5e7eb;cursor:pointer}
button.primary{background:var(--primary);color:#fff}
button.danger{background:var(--danger);color:#fff}
button.warn{background:var(--warn);color:#fff}
button.ghost{background:#fff;border:1px solid var(--line)}
button.del{background:#fff;border:1px solid var(--danger);color:var(--danger)}
button.del:hover{background:var(--danger);color:#fff}
button:disabled{opacity:.5;cursor:not-allowed}
.badge{display:inline-block;padding:2px 8px;border-radius:99px;font-size:11px;font-weight:700}
.b-listed{background:#dcfce7;color:#166534}.b-stopped{background:#fee2e2;color:#991b1b}
.b-draft{background:#e5e7eb;color:#374151}
.b-sync-pending{background:#d9f99d;color:#3f6212}
.src{display:inline-block;padding:1px 6px;border-radius:4px;font-size:10px;font-weight:700;margin-right:4px;color:#fff}
.src-yahoo_auction{background:#ff0033}.src-mercari{background:#ff5722}
.card{border:1px solid var(--line);border-radius:8px;margin-bottom:10px;background:#fff}
.card.deleting{opacity:.5}
.card.open{background:#f0f9ff;border-color:#7dd3fc}     /* 展開中の商品を視覚的に明示 */
.card.open .card-head{background:#f0f9ff;border-radius:8px 8px 0 0}
.card-head{display:grid;grid-template-columns:124px minmax(0,1fr) 170px;gap:12px;padding:10px;cursor:pointer;align-items:center}
.card-head .right{width:170px;flex-shrink:0;text-align:right;padding-left:48px;font-weight:700}
.card-head .imgcol{width:124px;flex:0 0 124px;display:flex;flex-direction:column;align-items:center;gap:4px}
.card-head img{width:84px;height:84px;max-width:84px;max-height:84px;object-fit:contain;background:#f3f4f6;border-radius:4px;display:block}
.state-badge{font-size:13px;padding:3px 12px}
/* ASIN / SKU / condition: fixed start columns, generous spacing */
.meta-line{display:grid;grid-template-columns:250px 300px minmax(0,1fr);column-gap:40px;white-space:nowrap}
.meta-line .monitor-meta{white-space:normal;overflow-wrap:anywhere;line-height:1.35}
/* fee row: fixed-width block (inline-grid) so labels & the update button never
   shift when amounts change; sits left in .ti leaving a wide gap before price */
.fee-line{display:grid;width:100%;max-width:100%;box-sizing:border-box;overflow:hidden;
  grid-template-columns:minmax(0,1.1fr) minmax(0,1.35fr) minmax(0,.85fr) minmax(0,.8fr) minmax(0,.85fr) minmax(0,1.15fr) 116px;
  align-items:center;column-gap:10px;white-space:nowrap;margin-top:8px;
  background:#f8fafc;border:1px solid var(--line);border-radius:6px;padding:7px 12px}
.fee-line-entry{grid-template-columns:200px 245px 165px 150px 165px}
.fee-line input.mini{width:66px;display:inline-block;padding:2px 4px}
.shipping-pattern-select{width:120px;height:26px;padding:2px 6px;font-size:12px;vertical-align:middle}
.fee-line .upd{justify-self:start}
.fee-line>span{min-width:0;overflow:hidden;text-overflow:ellipsis}
.fee-line .shipping-pattern-select{max-width:100%}
@media(max-width:1800px){
  .card-head .fee-line{grid-template-columns:repeat(3,minmax(0,1fr)) 116px;row-gap:5px}
  .card-head .fee-line>span:nth-child(1){grid-column:1;grid-row:1}
  .card-head .fee-line>span:nth-child(2){grid-column:2;grid-row:1}
  .card-head .fee-line>span:nth-child(3){grid-column:3;grid-row:1}
  .card-head .fee-line>span:nth-child(4){grid-column:1;grid-row:2}
  .card-head .fee-line>span:nth-child(5){grid-column:2;grid-row:2}
  .card-head .fee-line>span:nth-child(6){grid-column:3;grid-row:2}
  .card-head .fee-line .upd{grid-column:4;grid-row:1 / span 2;align-self:center}
  .card-head .fee-category-under{grid-column:2;grid-row:3}
}
@media(max-width:1450px){
  .card-head .fee-line{grid-template-columns:repeat(2,minmax(0,1fr)) 116px}
  .card-head .fee-line>span:nth-child(1){grid-column:1;grid-row:1}
  .card-head .fee-line>span:nth-child(2){grid-column:2;grid-row:1}
  .card-head .fee-line>span:nth-child(3){grid-column:1;grid-row:2}
  .card-head .fee-line>span:nth-child(4){grid-column:2;grid-row:2}
  .card-head .fee-line>span:nth-child(5){grid-column:1;grid-row:3}
  .card-head .fee-line>span:nth-child(6){grid-column:2;grid-row:3}
  .card-head .fee-line .upd{grid-column:3;grid-row:1 / span 3}
  .card-head .fee-category-under{grid-column:2;grid-row:4}
}
.fee-amazon{display:inline-block;line-height:normal}
.fee-category{display:block;max-width:240px;overflow:hidden;text-overflow:ellipsis;
  color:#8b95a1;font-size:11px;font-style:italic;margin-top:1px}
.fee-category-under{grid-column:2;grid-row:2;align-self:start}
.fee-rate.fallback{color:var(--danger);font-weight:700}
hr.split{border:0;border-top:2px dashed #cbd5e1;margin:12px 0}
button.stop{background:#38bdf8;color:#fff}
button.stop:hover{background:var(--primary-dark)}
/* FIXED table layout: column widths are locked (table-layout:fixed), so an empty
   即決 or long 100,000 never changes positions, and headers never go vertical.
   監視先 column has no fixed width → it absorbs slack, keeping 開く far from 現在.
   Numeric columns are centered so amounts sit evenly with gaps on both sides. */
.lst{width:100%;table-layout:fixed;border-collapse:collapse}
.lst th,.lst td{padding:6px 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle}
.lst th{color:var(--muted);font-weight:600}
.lst .col-num{text-align:center}
.lst .col-c{text-align:center}   /* 表題とデータを中央揃え（登録画面: サブコンディション/リードタイム/状態） */
.lst .col-yen{text-align:right;padding-right:10px}   /* 金額は右揃え(最大999,999想定) */
.lst .col-act{text-align:right}
.lst .col-act button{margin-left:12px}
.lst .watch-target-cell{padding-right:10ch}
.watch-target{display:flex;align-items:center;min-width:0}
.watch-target>.src,.watch-target>a,.watch-target>.muted{flex:0 0 auto}
.lst .lname{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;
  white-space:nowrap;vertical-align:bottom;margin:0 8px}   /* フリマ商品名: 利用可能幅を使用・はみ出しは省略 */
.cand-img{width:44px;height:44px;object-fit:cover;border-radius:4px;background:#f3f4f6;flex-shrink:0}
.cand-cell{display:flex;align-items:center;gap:8px;min-width:0}
.cand-cell a{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fee-line input.mini{text-align:right;-moz-appearance:textfield}
.fee-line input.mini::-webkit-outer-spin-button,.fee-line input.mini::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
/* entry: registration buttons unified blue; 再出品 lighter than 新規出品 */
button.btn-new{background:var(--primary);color:#fff}
button.btn-relist{background:#7dd3fc;color:#0c4a6e}
button.btn-relist:hover{background:#38bdf8;color:#fff}
.registration-progress-overlay{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;
  background:transparent;pointer-events:none}
.registration-progress-box{min-width:220px;padding:24px 32px;border:1px solid #7dd3fc;border-radius:10px;
  background:#fff;color:var(--ink);font-size:20px;font-weight:700;text-align:center;
  box-shadow:0 12px 30px rgba(15,23,42,.18)}
.entry-price-row{margin-top:6px;display:flex;align-items:center;justify-content:space-between;gap:12px}
.entry-price-line{display:flex;align-items:center;gap:8px;white-space:nowrap}
.entry-price-line .override-price-check{margin-left:9ch}
.override-price-check{display:flex;align-items:center;gap:4px;color:var(--ink);white-space:nowrap}
.override-price-check input{width:auto;margin:0}
.override-price-input{width:102px;padding:4px 8px;text-align:right}
.override-price-result{color:var(--muted);font-size:12px;white-space:nowrap}
.entry-action-row{align-items:center;flex-wrap:nowrap}
.relist-sku-select{width:190px}
button.btn-sky,a.btn-sky{display:inline-block;background:var(--primary);color:#fff;
  border:0;border-radius:6px;padding:7px 12px;text-decoration:none;cursor:pointer}
button.btn-sky:hover,a.btn-sky:hover{background:var(--primary-dark);color:#fff}
a.link-btn{line-height:normal}
/* small unified-height field (サブコンディション select と リードタイム input を同一高に) */
.field-sm{height:34px;padding:4px 8px;font-size:13px;line-height:1.2;width:auto}
/* filter row fonts = 仕入予想価格 (fee-line/.muted = 12px) */
.filter-row input,.filter-row select{font-size:12px}
/* settings one-line defaults */
.def-row{display:flex;gap:14px;align-items:flex-end;flex-wrap:nowrap}
.def-row label{display:block;font-size:11px;color:var(--muted);white-space:nowrap;margin-bottom:2px}
.def-row input,.def-row select{width:100%;height:34px;font-size:13px;padding:4px 8px}
.def-row .f{display:flex;flex-direction:column;flex-shrink:0}  /* 潰れてラベルが重なるのを防ぐ */
.shipping-template-sync{width:auto;height:34px;padding:4px 8px;white-space:nowrap}
/* detail: competitor (compact, left) + candidates (wide, left-aligned) */
.detail-grid{display:grid;grid-template-columns:max-content 1fr;gap:36px;align-items:start}
table.compact{width:auto}
table.compact th,table.compact td{padding:5px 20px 5px 0}
.list-grid{display:grid;gap:6px;margin-top:10px}
.list-item{display:flex;justify-content:space-between;align-items:center;gap:6px;
  border:1px solid var(--line);border-radius:6px;padding:4px 8px;font-size:13px;background:#fff;min-width:0}
.list-item>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.seller-item .seller-main{flex:1;min-width:0}
.seller-comment-input{width:20em;flex:0 0 20em;text-align:left;margin-left:auto}
.data-add-row{display:flex;align-items:flex-start;gap:8px;flex-wrap:nowrap;justify-content:flex-start}
.data-add-row textarea{resize:vertical;min-height:34px}
.seller-source-select{width:9rem;flex:0 0 9rem}
.add-value-box{flex:0 0 auto}
.add-value-box textarea{display:block}
.input-help{font-size:11px;color:var(--muted);line-height:1.2;margin-top:3px;white-space:nowrap}
.add-value-asin{width:15ch;flex:0 0 15ch}
.add-value-ja15{width:15em;flex:0 0 15em}
.add-value-seller{width:30ch;flex:0 0 30ch}
.add-comment-input{width:20em;flex:0 0 20em}
.fixed-three-list-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
.fixed-three-list-grid .compact-list-item{display:grid;grid-template-columns:minmax(0,max-content) minmax(0,1fr) auto;
  align-items:center;justify-content:start}
.fixed-three-list-grid .forbidden-asin-item{grid-template-columns:minmax(0,24ch) minmax(0,1fr) auto}
.compact-list-item .seller-main{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.compact-list-item .value-asin{width:12ch;max-width:100%}
.compact-list-item .value-ja15{width:15em;max-width:100%}
.compact-list-item .list-comment-input{width:20em;max-width:100%;min-width:0}
.asin-check-controls{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:8px}
.asin-check-main{display:flex;align-items:center;gap:4px;min-width:0}
.asin-value{display:inline-block;flex:0 0 12ch;width:12ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,Menlo,monospace}
.asin-check-result{display:inline-block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px;color:var(--muted)}
.asin-check-selling{color:#166534}
.asin-check-not_selling{color:#991b1b}
.asin-check-unknown{color:#b45309}
.asin-check-queued{color:var(--primary)}
.seller-list-grid .seller-item{display:flex}
.seller-list-grid .list-comment-input{width:20em;flex:0 0 20em;text-align:left;margin-left:auto}
.grid4{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.row-right{display:flex;justify-content:flex-end}
@media(max-width:900px){.grid4{grid-template-columns:1fr 1fr}.detail-grid{grid-template-columns:1fr}}
.card-head .ti{flex:1;min-width:0}
.sticky-filter{position:sticky;top:0;z-index:20}
.sticky-data{position:sticky;top:0;z-index:20;box-shadow:0 2px 6px rgba(0,0,0,.06)}
.tabs{display:flex;gap:4px;border-bottom:2px solid var(--line);margin-bottom:12px;flex-wrap:wrap}
.tabs .tab{padding:8px 14px;cursor:pointer;border:1px solid var(--line);border-bottom:0;
  border-radius:6px 6px 0 0;background:#f3f4f6;font-size:13px}
.tabs .tab.active{background:#fff;font-weight:700;color:var(--primary);border-bottom:2px solid #fff;margin-bottom:-2px}
.card-head .ti .t{font-weight:600;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.price-warn{color:var(--danger);font-weight:700}
.threshold-line{margin-bottom:6px}
.threshold-value,.threshold-offer-row td{color:var(--primary);font-weight:700}
.offers-scroll{overflow-y:auto;border:1px solid var(--line);border-radius:6px;background:#fff}
.offers-scroll .lst th{position:sticky;top:0;background:#fff;z-index:1}
.card-body{border-top:1px solid var(--line);padding:12px;background:#f0f9ff} /* 詳細=すごく薄い水色で一覧と区別 */
th.gap-l,td.gap-l{padding-left:42px} /* 即決↔残り の間隔を確保 */
table{width:100%;border-collapse:collapse;font-size:13px}
th,td{text-align:left;padding:6px 8px;border-bottom:1px solid var(--line)}
th{color:var(--muted);font-weight:600}
.nowrap{white-space:nowrap}
.muted{color:var(--muted);font-size:12px}
.right{text-align:right}
.mine{background:#eef9f4}
.toast{position:fixed;right:16px;bottom:16px;background:#111827;color:#fff;padding:10px 14px;border-radius:8px;font-size:13px;opacity:.95}
.toast.toast-above-top{bottom:72px}
.flex-between{display:flex;justify-content:space-between;align-items:center}
.pill-row{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}
.sku-action-row{display:grid;grid-template-columns:124px minmax(0,1fr) 170px;gap:12px;align-items:start;
  margin-left:-2px;margin-right:-2px}
.sku-action-buttons{grid-column:1;margin:8px 0;gap:6px;flex-wrap:nowrap}
.sku-action-buttons button{font-size:12px;padding:6px 7px;white-space:nowrap}
.condition-note-editor{grid-column:2;width:50%;display:grid;grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;gap:8px;box-sizing:border-box;background:#f8fafc;border:1px solid var(--line);
  border-radius:6px;padding:7px 12px;font-size:12px;margin:8px 0}
.condition-note-editor label{white-space:nowrap}
.condition-note-editor textarea{min-width:0;height:34px;min-height:34px;resize:vertical;padding:5px 7px;font-size:12px}
.condition-note-editor .condition-note-update{padding:3px 10px;white-space:nowrap;font-size:12px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.note-row{display:grid;grid-template-columns:230px 1fr;gap:12px;align-items:start;margin-bottom:8px}
.note-row .note-body textarea{width:100%}
.note-row input{padding:5px 8px}
@media(max-width:640px){.note-row{grid-template-columns:1fr}}
/* settings defaults: compact rows + right-pinned save */
.defaults label{display:block;font-size:12px;margin-bottom:2px}
.defaults input,.defaults select{padding:5px 8px}
.defaults-last{display:grid;grid-template-columns:1fr 1fr auto;gap:12px;align-items:end;margin-top:8px}
.defaults-last .save-cell{display:flex;justify-content:flex-end}

/* P3-1: 警告表示 — 商品名と同じ行の右端固定・赤文字・複数同時は並列（仕様書11章） */
.card-head{position:relative}
.warn-fixed{position:absolute;top:8px;right:12px;display:flex;gap:12px;
  color:#c00;font-weight:700;font-size:12.5px;pointer-events:none;white-space:nowrap;z-index:2}
.warn-inline{color:#c00;font-weight:700;font-size:11px;line-height:1.2} /* 価格表示の直上「金額変動」 */

/* P3-2: 設定画面の認証・巡回設定 */
.setting-grid{display:flex;gap:16px;flex-wrap:wrap;align-items:flex-end}
.setting-grid .f label{display:block;font-size:12px;margin-bottom:2px;color:var(--muted)}
.setting-grid .f input{padding:5px 8px}
.spapi-grid{align-items:flex-start}
.spapi-field{display:flex;flex-direction:column;justify-content:flex-start}
.spapi-field label{height:18px}
.spapi-field input{height:34px}
.secret-note{font-size:11px;margin-top:2px;height:14px;line-height:14px}
.crawl-setting-grid{align-items:flex-end}
.crawl-field{display:flex;flex-direction:column;justify-content:flex-start}
.crawl-field label{height:32px;line-height:14px}
.crawl-field label span,.crawl-field label small{display:block;white-space:nowrap}
.crawl-field label small{font-size:11px;color:var(--muted)}
.crawl-field input{height:34px}
.mono{font-family:ui-monospace,Menlo,monospace}
