/* ふぁまふぁい 共通の部品。色・書体・重なりの順は tokens.css の変数を使う */

/* ==========================================
   ラベルとヘルプ
   ========================================== */
/* ラベルの文字と「？」を 1 行に並べる */
.label-text { display: flex; align-items: center; gap: 0.5em; }

/* 「？」に触れる・フォーカスする・タップすると data-help の文を浮かせて出す */
.help-tip {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px;
  border: 1px solid var(--text-dim); border-radius: 50%;
  color: var(--text-muted); font-size: 0.75rem; line-height: 1;
  cursor: help;
}
/* 浮かせて出す文（common.js の initHelpTips が、画面からはみ出さない位置に置く） */
.help-float {
  position: fixed; z-index: calc(var(--z-popup) + 1);
  width: max-content; max-width: min(20em, calc(100vw - 16px));
  padding: 0.5em 0.75em;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-family: var(--font-ui); font-size: 0.75rem; font-weight: 400; line-height: 1.6; white-space: pre-line; text-align: left;
  pointer-events: none;
}

/* ==========================================
   パスワード欄（common.js の initPasswordFields が input を包む）
   ========================================== */
.password-field { position: relative; display: grid; }
/* 右側に「最後に打った文字」と表示ボタンが重なるので、その分だけ文字を入れない */
.password-field input { min-width: 0; padding-right: calc(44px + 2em); }

/* 押している間だけ中身を表示するボタン */
.password-reveal {
  position: absolute; right: 0; top: 0; bottom: 0;
  display: grid; place-items: center;
  width: 44px; min-height: 0; padding: 0;
  background: none; border: 0; border-radius: 6px;
  color: var(--text-muted); cursor: pointer;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.password-reveal svg { width: 20px; height: 20px; pointer-events: none; }
.password-reveal.is-held { color: var(--c-p-dark); }

/* 最後に打った 1 文字を少しの間だけ見せる */
.password-last {
  position: absolute; right: 44px; top: 50%; transform: translateY(-50%);
  padding: 0.25em 0.5em;
  background: var(--bg-sub); border: 1px solid var(--border); border-radius: 4px;
  color: var(--text); font-family: var(--font-mono); font-size: 1rem; line-height: 1;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-float) var(--ease-float);
}
.password-last.is-shown { opacity: 1; }

/* ==========================================
   利用者の画面の土台（layout.html の body.app の中だけに効かせる）
   ========================================== */
:root { --c-s-dark: oklch(0.42 0.09 var(--hue-s)); }
body.app, body.app * { box-sizing: border-box; }
body.app { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-ui); font-size: 1rem; line-height: 1.5; }
body.app a { color: var(--c-p-dark); text-decoration: none; }
body.app a:hover { color: var(--c-p); }
body.app button { font-family: var(--font-ui); cursor: pointer; }
body.app [hidden] { display: none !important; }

/* ── ヘッダーと上部ナビ ── */
body.app > header { position: sticky; top: 0; z-index: var(--z-header); background: var(--bg-card); border-bottom: 1px solid var(--border); }
.hd { max-width: 1820px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 20px; min-height: 3.75rem; }
.logo { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; color: var(--c-p-dark); display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.logo svg { width: 1.5rem; height: 1.5rem; }
/* 狭い画面では、右側の操作（売上／利益の切替・通知・アカウント）を 1 行に収めるためロゴをマークだけにする */
@media (max-width: 479px) { .logo-text { display: none; } }
.help-tip { flex: none; }
nav.top { display: flex; gap: 0.25rem; flex: 1; min-width: 0; overflow: hidden; }
nav.top a, nav.top .soon { display: flex; align-items: center; padding: 0 0.75rem; min-height: 2.75rem; border-radius: 8px; font-size: 0.875rem; color: var(--text-muted); white-space: nowrap; }
nav.top a:hover { background: var(--bg-sub); }
nav.top a.on { color: var(--c-p-dark); font-weight: 700; background: var(--c-p-light); }
.soon { cursor: default; }
nav.top .soon { color: var(--text-dim); }
.hd-r { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; position: relative; }
.bell { position: relative; width: 2.75rem; height: 2.75rem; border: 0; background: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex: none; }
/* 通知のポップアップ（タグ／本文／時刻／操作 の列を揃える） */
.nplist { display: grid; grid-template-columns: 4rem minmax(0, 1fr) 7.5rem max-content; gap: 8px 12px; align-items: center; max-height: 60dvh; overflow: auto; overscroll-behavior: contain; }
.nplist .ni { display: contents; }
.nplist .tag { justify-self: start; }
.nplist .nt { font-size: 0.875rem; min-width: 0; }
.nplist .nt.read { color: var(--text-muted); }
.nplist .ntime { font-size: 0.75rem; color: var(--text-dim); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nplist .nack { min-width: 3.5rem; font-size: 0.75rem; color: var(--text-dim); text-align: center; }
.nplist .empty { grid-column: 1 / -1; }
/* 狭い幅では 1 件を 2 段（タグ・時刻・操作／本文）にする。display: contents のままだと全件が同じ行に重なるので、件ごとの格子にする */
@media (max-width: 620px) {
  .nplist { display: flex; flex-direction: column; gap: 12px; }
  .nplist .ni { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 4px 8px; align-items: center; }
  .nplist .ni .tag { grid-row: 1; grid-column: 1; }
  .nplist .ni .ntime { grid-row: 1; grid-column: 2; text-align: left; }
  .nplist .ni .nack { grid-row: 1; grid-column: 3; justify-self: end; }
  .nplist .ni .nt { grid-row: 2; grid-column: 1 / -1; }
}
.bell:hover { background: var(--bg-sub); }
.bell svg { width: 1.25rem; height: 1.25rem; }
.bell .n { position: absolute; top: 0.375rem; right: 0.375rem; min-width: 1rem; height: 1rem; padding: 0 0.25rem; border-radius: 0.5rem; background: var(--c-a); color: var(--btn-text); font-size: 0.75rem; line-height: 1.35; text-align: center; font-weight: 700; }
.acct { display: flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; padding: 0 0.5rem; border: 0; background: none; border-radius: 8px; color: var(--text); }
.acct:hover { background: var(--bg-sub); }
.ava { width: 2rem; height: 2rem; border-radius: 50%; background: var(--c-p-light); color: var(--c-p-dark); font-family: var(--font-display); font-weight: 700; font-size: 0.875rem; display: flex; align-items: center; justify-content: center; flex: none; }
.acct .nm { font-size: 0.875rem; color: var(--text-muted); white-space: nowrap; }
.acct .tn { font-size: 0.75rem; font-weight: 700; color: var(--c-s-dark); background: var(--c-s-light); border-radius: 0.5rem; padding: 0.125rem 0.5rem; white-space: nowrap; max-width: 12em; overflow: hidden; text-overflow: ellipsis; }

/* アカウントのメニュー（契約の切替・ログアウト） */
.menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: var(--z-menu); min-width: 14em; padding: 8px; display: flex; flex-direction: column; gap: 4px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; }
.menu-name { padding: 0.25em 0.75em; font-size: 0.875rem; font-weight: 700; }
.menu-group { padding: 0.5em 0.75em 0; font-size: 0.75rem; color: var(--text-dim); }
.menu-item { display: flex; align-items: center; min-height: 2.75rem; padding: 0 0.75em; border: 0; background: none; border-radius: 8px; font-size: 0.875rem; color: var(--text); text-align: left; white-space: nowrap; }
.menu-item:hover { background: var(--bg-sub); }
.menu-item.on { background: var(--c-p-light); color: var(--c-p-dark); font-weight: 700; }

/* ── ページのグリッド（4 分割・最小ユニット 280px） ── */
body.app > main { max-width: 1820px; margin: 0 auto; padding: 20px; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(280px, (100% - 60px) / 4)), 1fr)); container-type: inline-size; align-items: stretch; }
/* 指で操作する端末（スマホ・タブレット）は最大 2 列 */
@media (pointer: coarse) { body.app > main { grid-template-columns: repeat(auto-fit, minmax(min(100%, max(280px, (100% - 20px) / 2)), 1fr)); } }
.span2 { grid-column: span 2; }
.span4 { grid-column: 1 / -1; }
@container (width < 580px) { .span2 { grid-column: auto; } }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; min-height: 0; }
.card h2 { margin: 0; font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.card h2 svg { width: 1.125rem; height: 1.125rem; color: var(--c-p); }
.chead { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.chead .sp { margin-left: auto; }
.note { font-size: 0.75rem; color: var(--text-dim); }
.mfoot { margin-top: auto; font-size: 0.75rem; color: var(--text-dim); }
/* 原本のポップアップ（売上明細・売上報告で共用） */
.dh { font-size: 0.75rem; color: var(--text-dim); }
.mailpre { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin: 0; font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.popup .cmpl, body.app #tbl tr.cmpr .cmpl { color: var(--text-muted); font-size: 0.875em; }
.empty { padding: 1.5em 0; font-size: 0.875rem; color: var(--text-dim); text-align: center; }
.load-error { font-size: 0.875rem; color: var(--color-danger); }

/* ── ページ見出しと基準日の操作 ── */
.datebar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.datebar h1 { margin: 0; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--c-p-dark); }
.dctl { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }
.db { min-width: 2.75rem; min-height: 2.75rem; border: 1px solid var(--border); background: var(--bg-card); border-radius: 8px; color: var(--text-muted); font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; }
.db:hover { background: var(--bg-sub); }
.db:disabled { color: var(--text-dim); background: var(--bg-sub); cursor: default; }
.cur { position: relative; display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; padding: 0 0.75rem; border: 1px solid var(--border); background: var(--bg-card); border-radius: 8px; font-size: 0.875rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.cur svg { width: 1rem; height: 1rem; color: var(--text-dim); }
/* 日付の欄は見た目を隠してボタン全体に重ね、押すと端末の日付選びが開くようにする */
.cur input[type="date"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.today-tag { font-size: 0.75rem; font-weight: 700; color: var(--c-p-dark); background: var(--c-p-light); border-radius: 0.5rem; padding: 0.125rem 0.5rem; }
.btn-s { min-height: 2.75rem; padding: 0 0.75rem; border: 1px solid var(--border); background: var(--bg-card); border-radius: 8px; font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.btn-s:hover { background: var(--bg-sub); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg-card); flex: none; }
.seg button { min-height: 2.75rem; padding: 0 0.75rem; border: 0; background: none; font-size: 0.875rem; color: var(--text-muted); white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--c-p-light); color: var(--c-p-dark); font-weight: 700; }

/* ── サマリーカード（ラベル／金額／点数／脚注 の段を揃える） ── */
.kpi { gap: 8px; display: grid; grid-template-rows: auto 2.5rem auto minmax(1.5rem, auto); align-content: start; }
.kpi .lb { font-size: 0.875rem; color: var(--text-muted); font-weight: 500; display: flex; align-items: center; gap: 0.5rem; }
.kpi .big { font-family: var(--font-display); font-weight: 700; font-size: 2rem; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; align-self: end; }
.kpi .big.rng { font-size: 1.5rem; }
.kpi .qty { font-size: 1rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.kpi .cmp { align-self: end; display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--text-dim); flex-wrap: wrap; }
.delta { font-size: 0.75rem; font-weight: 700; border-radius: 0.5rem; padding: 0.125rem 0.5rem; white-space: nowrap; }
.delta.up { color: var(--color-success); background: var(--c-p-light); }
.delta.dn { color: var(--color-danger); background: var(--c-a-light); }

/* ── タグと識別色の丸 ── */
.tag { display: inline-flex; align-items: center; font-size: 0.75rem; font-weight: 700; border-radius: 0.5rem; padding: 0.125rem 0.5rem; white-space: nowrap; }
.tag.info { background: var(--c-p-light); color: var(--c-p-dark); }
.tag.warn { background: var(--c-s-light); color: var(--c-s-dark); }
.tag.error { background: var(--c-a-light); color: var(--color-danger); }
.tag.soldout { background: var(--c-a); color: var(--btn-text); }
.tag.ai { background: var(--c-p); color: var(--btn-text); }
.tag.ref { background: var(--bg-sub); color: var(--text-muted); }
.dot { width: 0.5em; height: 0.5em; border-radius: 50%; flex: none; display: inline-block; }

/* ── グラフ（charts.js が中身を作る） ── */
.scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 0.375rem; }
.sw { width: 0.875rem; height: 0.875rem; border-radius: 2px; flex: none; }
.sw.q { background: var(--c-p); }
.sw.a { background: var(--c-s); }
.sw.avgq { background: repeating-linear-gradient(135deg, var(--c-p-dark) 0 2px, transparent 2px 6px); border: 1.5px solid var(--c-p-dark); }
.sw.avga { background: repeating-linear-gradient(135deg, var(--c-s-dark) 0 2px, transparent 2px 6px); border: 1.5px solid var(--c-s-dark); }
.sw.fq { background: var(--c-p-light); border: 1.5px dashed var(--c-p); }
.sw.fa { background: var(--c-s-light); border: 1.5px dashed var(--c-s); }
.chart { min-width: 580px; padding: 1.5rem 3.5rem 0; position: relative; }
/* 縦軸を左右に貼り付ける形（charts.js の renderAxes）。グラフ本体は目盛りの分の余白を持たない */
.scroll.axes { display: flex; align-items: flex-start; }
/* 右端の列の値が右の目盛りの下に隠れないよう、右だけ余白を広げる */
.scroll.axes .chart { padding-left: 0.5rem; padding-right: 2.5rem; flex: 1 0 auto; }
/* 棒の上に値を出すグラフは、上限いっぱいの棒の値と、重なりを避けて上へ逃がした値が見切れないように上の余白を広げる */
.chart.values { padding-top: 5rem; }
/* 比較の棒（.avg の z-index 2）より手前に置く */
.yaxis { position: sticky; flex: none; width: 3.5rem; padding-top: 1.5rem; background: var(--bg-card); z-index: 3; box-sizing: border-box; }
.yaxis.l { left: 0; }
.yaxis.r { right: 0; }
.yaxis .yplot { position: relative; }
.yaxis .axname { top: 0; }
.yaxis.l .yl { right: 0.5rem; padding-right: 0; }
.yaxis.r .yl { left: 0.5rem; padding-left: 0; }
.axname { position: absolute; top: 0; font-size: 0.75rem; font-weight: 700; }
.axname.l { left: 0; color: var(--c-p-dark); }
.axname.r { right: 0; color: var(--c-s-dark); }
.plot { position: relative; height: 240px; border-bottom: 2px solid var(--border); }
.gl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.yl { position: absolute; font-size: 0.75rem; color: var(--text-dim); font-variant-numeric: tabular-nums; transform: translateY(50%); line-height: 1; white-space: nowrap; }
.yl.l { right: 100%; padding-right: 0.5rem; text-align: right; color: var(--c-p-dark); }
.yl.r { left: 100%; padding-left: 0.5rem; color: var(--c-s-dark); }
.lanes { position: absolute; inset: 0; display: flex; align-items: stretch; }
.iv { flex: 1 1 0; display: flex; align-items: flex-end; justify-content: center; gap: 3px; min-width: 0; position: relative; }
/* 現在の位置の点線。枠線にするとその列だけ幅が増えるので、列に重ねて描く */
.iv.now::before { content: ''; position: absolute; left: 0; top: calc(1.125rem - var(--plot-top, 0px)); bottom: 0; border-left: 2px dashed var(--text-dim); pointer-events: none; }
/* 現在・ここから予測 の文字は、点・円の見出しと同じ高さ（グラフの一番上）に置く。棒の上の数字と重ならない */
.nowlb { position: absolute; top: calc(-1 * var(--plot-top, 1.375rem)); left: 0; transform: translateX(-50%); font-size: 0.75rem; color: var(--text-dim); white-space: nowrap; background: var(--bg-card); padding: 0 0.25rem; }
/* 棒は下から積む（色分けのときは属性ごとの段を積み上げる） */
.bcol { position: relative; width: 26%; max-width: 1.75rem; height: 100%; display: flex; flex-direction: column-reverse; align-items: stretch; }
.b { width: 100%; flex: none; }
.bcol > .b:last-of-type { border-radius: 2px 2px 0 0; }
.b.q { background: var(--c-p); }
.b.a { background: var(--c-s); }
.b.fq { background: var(--c-p-light); border: 1.5px dashed var(--c-p); border-bottom: 0; }
.b.fa { background: var(--c-s-light); border: 1.5px dashed var(--c-s); border-bottom: 0; }
.avg { position: absolute; left: 0; bottom: 0; width: 100%; z-index: 2; border-radius: 2px 2px 0 0; }
.avg.q { background: repeating-linear-gradient(135deg, var(--c-p-dark) 0 2px, transparent 2px 6px); border: 1.5px solid var(--c-p-dark); }
.avg.a { background: repeating-linear-gradient(135deg, var(--c-s-dark) 0 2px, transparent 2px 6px); border: 1.5px solid var(--c-s-dark); }
/* 棒の上の値（数量と金額を 2 段で。列の幅が足りないときは chart.novals で隠す） */
.cv { position: absolute; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; transform: translateY(-4px); font-size: 0.75rem; line-height: 1.1; font-variant-numeric: tabular-nums; pointer-events: none; white-space: nowrap; }
/* 値の文字には地の色を敷き、現在・ここから予測 の点線や目盛りの線が文字を横切らないようにする（列にマウスを乗せたときは列の色に合わせる） */
.cv { z-index: 2; }
.cv b { font-weight: 500; background: var(--bg-card); padding: 0 2px; border-radius: 2px; }
.iv:hover .cv b { background: var(--bg-sub); }
.cv .q { color: var(--c-p-dark); }
.cv .a { color: var(--c-s-dark); }
.cv.f { opacity: 0.6; }
.cv.zero .q { color: var(--text-dim); font-weight: 400; }
/* 値は棒のすぐ上に置き、ほかの値や棒と重なるときだけ上へ逃がす（charts.js の placeValueLabels が --rise を入れる） */
.cv { transform: translateY(calc(-4px - var(--rise, 0px))); }
.chart.novals .cv { display: none; }
.iv { cursor: default; }
.iv:hover { background: var(--bg-sub); }
.iv.drill { cursor: pointer; }
.xrow { display: flex; padding-top: 0.375rem; }
.xrow > span { flex: 1 1 0; text-align: center; font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 0; white-space: nowrap; }
.xrow.weather > span { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-dim); }
.xrow.weather svg { width: 1rem; height: 1rem; }

/* ── 表（列幅は文字数から em で逆算・左右 0.5 文字の余白・縮尺は --tbl-fs） ── */
.tscroll { overflow: auto; overscroll-behavior: contain; min-height: 0; }
body.app table { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: 100%; font-size: var(--tbl-fs, 0.875rem); }
body.app th { font-size: 0.875em; color: var(--text-dim); font-weight: 500; text-align: left; padding: 0 0.5em 0.5em; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--bg-card); }
body.app td { font-size: 1em; padding: 0.5em; border-bottom: 1px solid var(--bg-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.app th.num, body.app td.num { text-align: right; font-variant-numeric: tabular-nums; }
body.app td.num { overflow: visible; text-overflow: clip; }
body.app td.dim { color: var(--text-dim); }
body.app th.sub { padding-top: 0; font-size: 0.75em; }
body.app thead th { position: sticky; top: 0; z-index: 2; }
body.app thead tr:first-child th { height: 2em; }
body.app thead tr + tr th { top: 2em; }
body.app tfoot td { border-bottom: 0; border-top: 1px solid var(--border); font-weight: 700; background: var(--bg-card); }
/* 2 段の見出し（日付 → 点・円）: 日付と点・円の間に横線は引かず、日付のまとまりごとに縦線で区切る */
body.app th.grp { border-bottom: 0; }
body.app th.gsep, body.app td.gsep { border-left: 1px solid var(--border); }
/* 合計の 2 列（点・円）は右端に貼り付ける（横にスクロールしても見える） */
.stickr1, .stickr2 { position: sticky; background: var(--bg-card); }
/* 点の列の位置は、円の列の実際の幅（表が広いときは比率で伸びる）を common.js の tableZoom が測って --stickr に入れる */
.stickr1 { right: var(--stickr, 6.5em); }
.stickr2 { right: 0; }
body.app thead th.stickr1, body.app thead th.stickr2 { z-index: 3; }
body.app tbody td.stickr1, body.app tbody td.stickr2, body.app tfoot td.stickr1, body.app tfoot td.stickr2 { z-index: 1; }
.stick1, .stick2 { position: sticky; background: var(--bg-card); }
.stick1 { left: 0; }
.stick2 { border-right: 1px solid var(--border); }
body.app thead th.stick1, body.app thead th.stick2 { z-index: 3; }
body.app tbody td.stick1, body.app tbody td.stick2, body.app tfoot td.stick1, body.app tfoot td.stick2 { z-index: 1; }
.cell-name { display: flex; align-items: flex-start; gap: 0.4em; min-width: 0; }
.cell-name .dot { margin-top: 0.45em; }
.cell-name .nm1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cell-name .tnote { display: block; font-size: 0.875em; color: var(--text-dim); white-space: normal; line-height: 1.35; font-weight: 500; }
.cell-name .tnote.warn { color: var(--c-s-dark); }
body.app tr.grow td { border-bottom: 1px solid var(--border); padding-top: 0.75em; font-weight: 700; overflow: visible; }
body.app tr.grow td .cell-name { align-items: center; }
body.app tr.grow td .dot { margin-top: 0; }
body.app table .tag { font-size: 0.875em; padding: 0.125em 0.5em; }
/* 表の縮尺の操作（表があふれているときだけ出す） */
.zoom { display: none; align-items: center; gap: 0.5rem; }
.zoom.show { display: flex; }

/* ── モバイル用ナビ（下部のバー＋「その他」のシート） ── */
nav.bottom { display: none; }
body.mnav nav.top { visibility: hidden; }
body.mnav .acct .nm, body.mnav .acct .tn { display: none; }
body.mnav .hd { gap: 8px; }
body.mnav > main { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom) + 20px); }
/* 項目（アイコン＋名前）を均等割り */
body.mnav nav.bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-header); background: var(--bg-card); border-top: 1px solid var(--border); padding: 0.25rem 0.25rem calc(0.25rem + env(safe-area-inset-bottom)); }
nav.bottom a, nav.bottom .soon { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.125rem; min-height: 2.75rem; padding: 0.25rem; border-radius: 8px; font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
nav.bottom .soon { color: var(--text-dim); }
nav.bottom svg { width: 1.25rem; height: 1.25rem; }
nav.bottom a.on { color: var(--c-p-dark); font-weight: 700; background: var(--c-p-light); }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.2); z-index: var(--z-sheet); display: none; }
/* 閉じている間は見えない・押せない（開くときは即、閉じるときは動きが終わってから隠す） */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sheet); background: var(--bg-card); border-top: 1px solid var(--border); border-radius: 8px 8px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; transform: translateY(105%); transition: transform var(--dur-float) var(--ease-float), visibility 0s linear var(--dur-float); pointer-events: none; visibility: hidden; }
body.sheet-open #navSheet, body.tags-open #tagSheet, body.add-open #addSheet { visibility: visible; transition-delay: 0s; }
.sheet h3 { margin: 0; font-size: 0.75rem; font-weight: 500; color: var(--text-dim); }
.sheet a, .sheet .soon { display: flex; align-items: center; gap: 0.75rem; min-height: 2.75rem; padding: 0 0.75rem; border-radius: 8px; font-size: 1rem; color: var(--text); }
.sheet .soon { color: var(--text-dim); }
.sheet a:hover { background: var(--bg-sub); }
.sheet a.on { background: var(--c-p-light); color: var(--c-p-dark); font-weight: 700; }
.sheet svg { width: 1.25rem; height: 1.25rem; color: var(--text-muted); }
body.sheet-open .scrim { display: block; }
body.sheet-open #navSheet { transform: none; pointer-events: auto; }
#navSheet { z-index: calc(var(--z-sheet) + 1); }

/* ── ポップアップ（枠の外を押すと閉じる。幅は 4 分割のスパン 880 / 1330 / 1780） ── */
.popup-scrim { position: fixed; inset: 0; z-index: var(--z-popup); background: rgba(0, 0, 0, 0.2); display: grid; place-items: center; padding: 20px; }
.popup { width: min(100%, var(--popup-width, 880px)); max-height: calc(100dvh - 40px); overflow: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.popup h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.popup .ptext { margin: 0; font-size: 0.875rem; }
.phead { display: flex; align-items: flex-start; gap: 0.75rem; }
.phead h2 { margin: 0; font-size: 1.125rem; font-weight: 700; font-family: var(--font-display); color: var(--c-p-dark); flex: 1; min-width: 0; }
.pclose { width: 2.75rem; height: 2.75rem; margin: -0.5rem -0.5rem 0 0; border: 0; background: none; border-radius: 8px; color: var(--text-muted); font-size: 1.25rem; display: flex; align-items: center; justify-content: center; flex: none; }
.pclose:hover { background: var(--bg-sub); }
.btn-s.danger { color: var(--color-danger); border-color: var(--color-danger); }
.popup .popup-foot { display: flex; justify-content: flex-end; gap: 8px; }

/* ── 編集のポップアップ（ラベル／入力の 2 列。狭い幅では 1 列） ── */
.pform { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 12px 16px; align-items: center; }
.pform .pl { font-size: 0.875rem; color: var(--text-muted); }
.pform .pl.top { align-self: start; padding-top: 0.75rem; }
.pform .pv { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pform .pv .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pform .sel { width: 100%; }
@media (max-width: 620px) { .pform { grid-template-columns: 1fr; } .pform .pl.top { padding-top: 0; } }
/* 略称の案内と、表での見え方の見本 */
.hint { font-size: 0.75rem; color: var(--c-s-dark); }
.sample { display: inline-flex; align-items: center; gap: 0.4em; font-size: 0.875rem; background: var(--bg-sub); border-radius: 8px; padding: 0.25rem 0.75rem; max-width: 8.5em; }
.sample .nm1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.popup .pfoot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.popup .pfoot .left { margin-right: auto; }
.check { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; font-size: 0.875rem; }
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--c-p); }
