/* ============================================================
 * weightPaper.css — 重量タブ「白い紙」(PC)。2026-11-28 master 指示
 *   方眼紙の上に A4 の白い紙。明細は紙に縦に並び、下の黒いバーで 道具・書類の種類・項目・出力 を切り替える。
 *   スマホ (body.mobile-shell / body.mobile-app) は従来の #wpp .layout を使う (この紙は出さない)。
 *   v1.34.1 (master「最初の画面は前のほうが見やすい。出力・重量計算書を押すと今の画面に」):
 *   PC も最初は従来の画面 (左で入力・右に一覧)。#wpp.wp-paper-mode のときだけ紙を出す (paperSheet.js wPaperOpen)。
 * ============================================================ */

#wpp .wp-stage,
#wpp .wp-bar{ display:none; }
body:not(.mobile-shell):not(.mobile-app) #wpp.show{ position:relative; }
body:not(.mobile-shell):not(.mobile-app) #wpp.wp-paper-mode > .layout{ display:none !important; }
/* 従来の画面 (PC) では、紙の「＋項目」で後から足すオプションのボタン (バッジ) と印刷タイトルの行は出さない
   (master 2026-11-28「重量タブはバッジをなくしたい」) */
body:not(.mobile-shell):not(.mobile-app) #wpp .w-opt-chips,
body:not(.mobile-shell):not(.mobile-app) #wpp [id^="wPanel_"],
body:not(.mobile-shell):not(.mobile-app) #wpp #wDocTitleText{ display:none !important; }
body:not(.mobile-shell):not(.mobile-app) #wpp.wp-paper-mode .wp-stage{
  display:block;
  width:100%;
  min-height:calc(100vh - var(--toriai-header-h, 0px));
  overflow:auto;
  padding:28px 24px 120px;
  box-sizing:border-box;
  background-color:var(--toriai-app-bg, #f6fafc);
  background-image:var(--toriai-grid-paper, none);
  background-size:48px 48px, 48px 48px;
  background-attachment:fixed;
}
body:not(.mobile-shell):not(.mobile-app) #wpp.wp-paper-mode .wp-bar{ display:flex; }
/* 紙のときは左の列が無いので、左の列の上に出していた TORIAI のロゴ帯も出さない */
html:not(.nav-top) body.page-weight-active.wp-paper-open:not(.mobile-app):not(.mobile-shell) > header .logo .logo-image{ display:none !important; }
#wpp .wp-paper [hidden],
#wpp .wp-bar [hidden]{ display:none !important; }

/* ── 紙 ─────────────────────────────────────── */
#wpp .wp-paper{
  position:relative;
  width:794px;            /* A4 (210mm) を 96dpi で。印刷も同じ幅なので付箋・手書きの位置がずれない */
  min-height:1123px;
  margin:0 auto;
  padding:56px 56px 40px;
  box-sizing:border-box;
  background:#ffffff;
  border-radius:4px;
  box-shadow:0 1px 3px rgba(20, 24, 26, .10), 0 8px 24px rgba(20, 24, 26, .05);
  color:#1d1e1f;
  font-size:14px;
  font-variant-numeric:tabular-nums;
}
/* 旧 CSS の input の枠 (角丸・高さ) が強いので !important で紙の書き込み欄 (下線だけ) にする */
#wpp .wp-paper input[type="text"]{
  font:inherit; color:inherit; background:transparent !important;
  height:auto !important; min-height:0 !important; margin:0 !important;
  border:0 !important; border-bottom:1px solid transparent !important; border-radius:0 !important;
  padding:3px 2px !important; box-shadow:none !important;
}
#wpp .wp-paper input[type="text"]:hover{ border-bottom-color:#d6dbde !important; }
#wpp .wp-paper input[type="text"]:focus{ outline:none !important; border-bottom-color:#1d1e1f !important; }
#wpp .wp-paper input::placeholder{ color:#b3b8bb; }

#wpp .wp-titlebar{
  display:flex; justify-content:space-between; align-items:flex-end; gap:16px;
  border-bottom:2px solid #1d1e1f; padding-bottom:12px;
}
#wpp .wp-title{ font-size:26px; font-weight:700; letter-spacing:.2em; }
#wpp .wp-meta{ display:flex; flex-direction:column; align-items:flex-end; gap:2px; }
#wpp .wp-date{ font-size:13px; color:#3a3d40; }
#wpp .wp-from{ width:200px; text-align:right; font-size:13px !important; }

#wpp .wp-addr{ display:flex; align-items:baseline; gap:8px; margin-top:18px; font-size:17px; }
#wpp .wp-addr input[type="text"]{ width:280px; font-size:17px; border-bottom-color:#c9ced1 !important; }
#wpp .wp-subject{ display:flex; align-items:baseline; gap:10px; margin-top:6px; font-size:14px; }
#wpp .wp-lbl{ font-size:12px; color:#6d7277; }
#wpp .wp-subject input{ width:320px; }
#wpp .wp-lead{ margin-top:14px; font-size:13px; }
#wpp .wp-prices{ display:flex; justify-content:flex-end; gap:18px; margin-top:6px; font-size:13px; color:#3a3d40; }
#wpp .wp-prices label{ display:flex; align-items:baseline; gap:4px; }
#wpp .wp-prices input[type="text"]{ width:64px; border-bottom-color:#c9ced1 !important; }

/* 表 */
#wpp .wp-head,
#wpp .wp-row{ display:grid; gap:8px; padding:9px 8px; align-items:baseline; }
#wpp .wp-head{ margin-top:22px; font-size:12px; color:#5f6569; border-bottom:1px solid #d6dbde; }
#wpp .wp-head:empty{ display:none; }
#wpp .wp-hc{ display:flex; align-items:center; gap:4px; white-space:nowrap; }
#wpp .wp-hc.wp-r{ justify-content:flex-end; }
#wpp .wp-col-x{
  width:18px; height:18px; padding:0; border:0; border-radius:4px; background:transparent;
  color:#9aa0a4; font:inherit; font-size:13px; line-height:18px; cursor:pointer; opacity:0;
}
#wpp .wp-head:hover .wp-col-x{ opacity:1; }
#wpp .wp-col-x:hover{ background:#eceff1; color:#1d1e1f; }
#wpp .wp-row{ font-size:15px; border-bottom:1px solid #eceff1; border-radius:4px; }
#wpp .wp-paper[data-tool="write"] .wp-row,
#wpp .wp-paper[data-tool="select"] .wp-row{ cursor:pointer; }
#wpp .wp-paper[data-tool="write"] .wp-row:hover{ background:#f6f8f9; }
#wpp .wp-row.is-sel{ background:#e6edf5; }
#wpp .wp-row.is-edit{ background:#fff7e6; }
#wpp .wp-r{ text-align:right; }
#wpp .wp-c{ min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#wpp .wp-name{ font-weight:500; }
#wpp .wp-note{ font-size:12px; color:#8a5a1e; margin-left:4px; }
#wpp .wp-c-uw{ font-size:13px; color:#5f6569; }
#wpp .wp-paper input.wp-cell-in{ width:100%; box-sizing:border-box; font-size:14px !important; border-bottom-color:#e3e7e9 !important; }
#wpp .wp-cell-in.wp-r{ text-align:right; }

/* 1 行入力 */
#wpp .wp-cmd-wrap{ position:relative; padding:10px 8px; border-bottom:1px dashed #cfd4d7; }
#wpp .wp-paper input#wpCmd{ width:100%; font-size:15px; padding:4px 0 !important; border-bottom:0 !important; }
#wpp .wp-paper input#wpCmd:focus{ border-bottom:0 !important; }
#wpp .wp-hint{ margin-top:4px; font-size:12px; color:#5f6569; white-space:normal; }
#wpp .wp-err{ margin-top:4px; font-size:12px; color:#a23b2a; }
#wpp .wp-drop{
  position:absolute; left:8px; top:42px; z-index:6; width:360px; max-height:320px; overflow:auto;
  padding:6px; background:#ffffff; border:1px solid #e1e5e7; border-radius:10px;
  box-shadow:0 8px 24px rgba(20, 24, 26, .12);
}
#wpp .wp-dd-item{
  display:flex; justify-content:space-between; align-items:center; gap:12px; width:100%; min-height:40px;
  padding:8px 12px; border:0; border-radius:6px; background:transparent;
  font:inherit; font-size:14px; color:#1d1e1f; text-align:left; cursor:pointer;
}
#wpp .wp-dd-item.on,
#wpp .wp-dd-item:hover{ background:#eef2f4; }
#wpp .wp-dd-ex{ font-size:12px; color:#7d8286; white-space:nowrap; }

#wpp .wp-totals{ display:flex; justify-content:flex-end; gap:26px; margin-top:18px; font-size:15px; flex-wrap:wrap; }
#wpp .wp-tot b{ font-size:20px; font-weight:700; margin:0 6px 0 8px; }

/* ── 付箋・手書き ─────────────────────────────── */
#wpp .wp-ann{ position:absolute; inset:0; pointer-events:none; z-index:4; }
#wpp .wp-ann svg{ position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
#wpp .wp-stroke{ fill:none; stroke:#b42318; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; pointer-events:none; }
#wpp .wp-stroke.is-sel{ stroke:#3a6ea5; stroke-width:3; }
#wpp .wp-stroke-hit{ fill:none; stroke:transparent; stroke-width:14; stroke-linecap:round; pointer-events:none; }
#wpp .wp-paper[data-tool="select"] .wp-stroke-hit{ pointer-events:stroke; cursor:pointer; }
#wpp .wp-paper[data-tool="pen"]{ cursor:crosshair; }
#wpp .wp-paper[data-tool="pen"] .wp-row{ cursor:crosshair; }
#wpp .wp-paper[data-tool="sticky"]{ cursor:copy; }
#wpp .wp-sticky{
  position:absolute; width:168px; pointer-events:auto;
  background:#fff3b0; box-shadow:0 1px 3px rgba(0,0,0,.16), 0 6px 14px rgba(0,0,0,.06);
}
#wpp .wp-sticky-grip{ display:flex; justify-content:flex-end; height:18px; cursor:grab; background:rgba(0,0,0,.04); }
#wpp .wp-sticky-grip:active{ cursor:grabbing; }
#wpp .wp-sticky-x{ width:18px; height:18px; padding:0; border:0; background:transparent; color:#6d6230; font-size:13px; line-height:18px; cursor:pointer; }
#wpp .wp-sticky-x:hover{ color:#1d1e1f; }
#wpp .wp-sticky-text{
  display:block; width:100% !important; min-height:56px; box-sizing:border-box; padding:6px 10px 10px !important; margin:0 !important;
  border:0 !important; border-radius:0 !important; background:transparent !important; box-shadow:none !important;
  resize:none; overflow:hidden; font:inherit; font-size:13px !important; line-height:1.5; color:#1d1e1f;
}
#wpp .wp-sticky-text:focus{ outline:none; }

/* ── 下のバー (ホワイトボードの道具箱) ─────────────── */
#wpp .wp-bar{
  position:fixed; left:50%; bottom:20px; transform:translateX(calc(-50% + 30px)); z-index:40;
  align-items:center; gap:4px; padding:6px;
  background:#1d1e1f; border-radius:14px; box-shadow:0 6px 20px rgba(0,0,0,.22);
}
#wpp .wp-bar button{
  height:40px; min-width:40px; padding:0 12px; border:0; border-radius:10px;
  background:transparent; color:#e9eaeb; font:inherit; font-size:13px; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; gap:6px; white-space:nowrap;
}
#wpp .wp-bar button.wp-ico{ width:40px; padding:0; }
#wpp .wp-bar button:hover{ background:#33363a; }
#wpp .wp-bar button:focus-visible{ outline:2px solid #ffffff; outline-offset:-2px; }
#wpp .wp-bar button[data-tool].on{ background:#3a6ea5; color:#ffffff; }
#wpp .wp-bar button[data-doc].on{ background:#ffffff; color:#1d1e1f; font-weight:700; }
#wpp .wp-bar button:disabled{ opacity:.35; cursor:default; background:transparent; }
#wpp .wp-bar #wpDelSel{ background:#a23b2a; color:#ffffff; }
#wpp .wp-bar #wpDelSel[hidden]{ display:none; }
#wpp .wp-sep{ width:1px; height:24px; background:#45484c; margin:0 4px; }
#wpp .wp-menu-wrap{ position:relative; }
#wpp .wp-menu{
  position:absolute; bottom:52px; right:0; min-width:200px; padding:6px;
  background:#ffffff; border:1px solid #e1e5e7; border-radius:10px; box-shadow:0 10px 28px rgba(0,0,0,.18);
  display:flex; flex-direction:column; gap:2px;
}
#wpp .wp-menu[hidden]{ display:none; }
#wpp .wp-bar .wp-menu button{
  justify-content:space-between; width:100%; height:38px; color:#1d1e1f; font-size:13px;
}
#wpp .wp-bar .wp-menu button:hover{ background:#eef2f4; }
#wpp .wp-bar .wp-menu button:disabled{ background:transparent; }
#wpp .wp-menu button[aria-checked]::after{ content:''; width:16px; height:16px; border:1.5px solid #9aa0a4; border-radius:4px; box-sizing:border-box; }
#wpp .wp-menu button[aria-checked="true"]::after{ background:#1d1e1f; border-color:#1d1e1f; box-shadow:inset 0 0 0 3px #ffffff; }
#wpp .wp-menu .wp-menu-sep{ height:1px; background:#eceff1; margin:4px 2px; }
#wpp .wp-menu .wp-danger{ color:#a23b2a; }

#wpp .wp-credit{ display:none; }

/* ── 印刷 (paperSheet.js wPaperPrint が body.wp-printing と #wpp.print-target を付ける) ──
   画面の紙をそのまま A4 縦で刷る。全体の印刷設定 (calc.css: A4 横) は名前付きページで上書きしない。
   操作用の部品は visibility:hidden にして場所を残す (付箋・手書きが行とずれない)。 */
@page wpA4{ size:A4 portrait; margin:0; }
@media print{
  body.wp-printing{ font-size:14px !important; }
  body.wp-printing #wpp.print-target{ display:block !important; position:static !important; }
  body.wp-printing #wpp .wp-stage{
    display:block !important; padding:0 !important; margin:0 !important; overflow:visible !important;
    min-height:0 !important; background:none !important;
  }
  body.wp-printing #wpp .wp-bar,
  body.wp-printing #wpp .wp-drop{ display:none !important; }
  body.wp-printing #wpp .wp-paper{ page:wpA4; margin:0 !important; border-radius:0 !important; box-shadow:none !important; }
  body.wp-printing #wpp .wp-cmd-wrap,
  body.wp-printing #wpp .wp-paper.wp-no-to .wp-addr,
  body.wp-printing #wpp .wp-paper.wp-no-subject .wp-subject,
  body.wp-printing #wpp .wp-paper.wp-no-from .wp-from,
  body.wp-printing #wpp .wp-sticky.wp-empty,
  body.wp-printing #wpp .wp-sticky-grip{ visibility:hidden !important; }
  body.wp-printing #wpp .wp-paper input::placeholder{ color:transparent !important; }
  /* 単価を打っていない行は紙の @単価 (placeholder) を刷る */
  body.wp-printing #wpp .wp-paper input[data-f="ownPrice"]::placeholder{ color:#1d1e1f !important; }
  body.wp-printing #wpp .wp-prices input[type="text"],
  body.wp-printing #wpp .wp-paper input.wp-cell-in,
  body.wp-printing #wpp .wp-subject input[type="text"],
  body.wp-printing #wpp .wp-from{ border-bottom-color:transparent !important; }
  body.wp-printing #wpp .wp-sticky-text{ resize:none; overflow:hidden; }
  body.wp-printing #wpp .wp-row.is-sel,
  body.wp-printing #wpp .wp-row.is-edit{ background:transparent !important; }
  body.wp-printing #wpp .wp-credit{ display:block; position:absolute; right:56px; bottom:20px; font-size:9px; color:#9aa0a4; }
}

/* 狭い窓: バーのボタンの余白を詰める */
@media (max-width:1100px){
  #wpp .wp-bar button{ padding:0 9px; }
  #wpp .wp-stage{ padding-left:12px; padding-right:12px; }
}

/* 見積依頼書の「希望納期・備考」は数量と少し離す */
#wpp .wp-c-req{ padding-left:12px; }

/* ── Excel・CSV の取り込み (sheetImportUI.js) ───────────────── */
#wpp .wi-drop-hint{ display:none; }
#wpp.wi-dragging .wi-drop-hint{
  display:flex; align-items:center; justify-content:center;
  position:fixed; inset:0 0 0 var(--toriai-rail-w, 60px); z-index:8000; pointer-events:none;
  background:rgba(29,30,31,.06); border:3px dashed #3a6ea5; box-sizing:border-box;
  font-size:18px; font-weight:700; color:#1d1e1f;
}
.wi-modal{
  position:fixed; inset:0; z-index:9000; display:flex; align-items:center; justify-content:center;
  background:rgba(20,22,24,.32); padding:24px; box-sizing:border-box;
}
.wi-modal[hidden]{ display:none !important; }
.wi-box{
  display:flex; flex-direction:column; width:min(1080px, 100%); max-height:100%;
  background:#ffffff; border-radius:12px; box-shadow:0 20px 48px rgba(0,0,0,.22); overflow:hidden;
}
.wi-head{ padding:18px 22px 10px; border-bottom:1px solid #eceff1; }
.wi-title{ font-size:17px; font-weight:700; color:#1d1e1f; }
.wi-info{ margin-top:4px; font-size:12px; color:#5f6569; line-height:1.6; }
.wi-scroll{ overflow:auto; flex:1 1 auto; }
.wi-table{ width:100%; border-collapse:collapse; font-size:13px; font-variant-numeric:tabular-nums; }
.wi-table th{ position:sticky; top:0; background:#f6f8f9; z-index:1; text-align:left; font-size:11px; color:#5f6569; padding:8px 10px; border-bottom:1px solid #e1e5e7; }
.wi-table td{ padding:6px 10px; border-bottom:1px solid #f0f2f3; vertical-align:middle; }
.wi-table .wi-c{ width:28px; }
.wi-table .wi-n{ width:44px; color:#7d8286; }
.wi-table .wi-kg{ width:84px; text-align:right; white-space:nowrap; }
.wi-table .wi-src{ color:#7d8286; }
.wi-table .wi-read{ color:#3a3d40; }
.wi-table input.wi-text{
  width:100% !important; box-sizing:border-box; height:30px !important; padding:0 8px !important; margin:0 !important;
  border:1px solid #d6dbde !important; border-radius:6px !important; background:#ffffff !important; box-shadow:none !important;
  font:inherit; font-size:13px !important; color:#1d1e1f;
}
.wi-table select.wi-cand{ max-width:100%; height:30px; border:1px solid #e0b25c; border-radius:6px; font:inherit; font-size:12px; background:#fffaf0; }
.wi-table tr.wi-cands td,
.wi-table tr.wi-diff td{ background:#fff8eb; }
.wi-table tr.wi-error td{ background:#fdf0ee; }
.wi-table tr.wi-error .wi-read{ color:#a23b2a; }
.wi-table tr.wi-diff .wi-src{ color:#9a3412; font-weight:700; }
.wi-foot{ display:flex; align-items:center; gap:10px; padding:12px 18px; border-top:1px solid #eceff1; flex-wrap:wrap; }
.wi-note{ flex:1 1 auto; font-size:12px; color:#7d8286; }
.wi-btn{
  height:36px; padding:0 14px; border:1px solid #d0d6da; border-radius:8px; background:#ffffff;
  font:inherit; font-size:13px; color:#1d1e1f; cursor:pointer;
}
.wi-btn:hover{ background:#f2f4f5; }
.wi-btn.wi-primary{ background:#1d1e1f; border-color:#1d1e1f; color:#ffffff; font-weight:700; }
.wi-btn.wi-primary:disabled{ opacity:.4; cursor:default; }
.wi-table select.wi-cand{ height:32px !important; min-height:0 !important; padding:0 8px !important; line-height:normal !important; margin:0 !important; }
#wpp .w-import-btn{ text-transform:none !important; letter-spacing:0 !important; }
