/* 発電モニター（/portfolio/monitor）— 日次発電×健康状態ボード */

.mon-wrap { max-width: 1240px; margin: 0 auto; padding: 24px 16px 48px; }
.mon-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.mon-h1 { font-size: 24px; font-weight: 800; color: var(--pv-ink, #0f172a); margin: 0 0 4px; }
.mon-sub { font-size: 12.5px; color: var(--pv-muted, #64748b); margin: 0; }

/* ① Status KPI */
.mon-kpis { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.mon-kpi { background: var(--pv-surface, #fff); border: 1px solid var(--pv-border, #e5eae7);
  border-radius: 14px; padding: 14px 18px; }
.mon-kpi .k { font-size: 11.5px; font-weight: 700; color: var(--pv-muted, #64748b); margin-bottom: 4px; }
.mon-kpi .v { font-size: 26px; font-weight: 800; color: var(--pv-ink, #0f172a);
  font-variant-numeric: tabular-nums; line-height: 1.15; }
.mon-kpi .v .u { font-size: 12px; font-weight: 600; color: var(--pv-muted, #64748b); }
.mon-kpi .s { font-size: 11.5px; color: var(--pv-ink-2, #475569); margin-top: 2px; }
.mon-kpi--main { background: #ecfdf5; border-color: #a7f3d0; }
.mon-kpi--main .v { color: #00734f; }

/* ② Work: 異常 */
.mon-alert { border: 1px solid #fecaca; background: #fef2f2; border-radius: 14px;
  padding: 12px 16px; margin-bottom: 16px; }
.mon-alert-head { font-size: 13px; font-weight: 800; color: #b91c1c; margin-bottom: 6px; }
.mon-alert-list { margin: 0; padding-left: 18px; font-size: 12.5px; color: #7f1d1d; line-height: 1.9; }
.mon-alert-list a { color: #b91c1c; }
.mon-clear { border: 1px solid #a7f3d0; background: #ecfdf5; color: #00734f;
  border-radius: 14px; padding: 12px 16px; font-size: 13px; font-weight: 700; margin-bottom: 16px; }

/* ③ カードグリッド */
.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.mon-card { display: block; background: var(--pv-surface, #fff); border: 1px solid var(--pv-border, #e5eae7);
  border-radius: 14px; padding: 12px 14px 10px; text-decoration: none; color: inherit;
  transition: box-shadow .15s, border-color .15s; }
/* 紙面: hover は浮かせず罫線の濃化のみ（2026-09-07） */
.mon-card:hover { border-color: var(--pv-ink-2, #475569); }
.mon-card--warn { border-color: #fecaca; background: #fffbfb; }
.mon-card--warn:hover { border-color: #f87171; }

.mon-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mon-health { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 800; }
.mon-health i { width: 7px; height: 7px; border-radius: 50%; }
.mon-health--ok { color: #00734f; }
.mon-health--ok i { background: #10b981; }
.mon-health--danger { color: #b91c1c; }
.mon-health--danger i { background: #ef4444; }
.mon-health--warn { color: #b45309; }
.mon-health--warn i { background: #f59e0b; }
.mon-health--muted { color: var(--pv-muted, #94a3b8); }
.mon-health--muted i { background: #cbd5e1; }
.mon-kwp { font-size: 10.5px; font-weight: 700; color: var(--pv-muted, #64748b); }

.mon-card-name { font-size: 12.5px; font-weight: 700; color: var(--pv-ink, #0f172a);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.mon-card-val { font-size: 20px; font-weight: 800; color: var(--pv-ink, #0f172a);
  font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 8px; }
.mon-card-val .u { font-size: 11px; font-weight: 600; color: var(--pv-muted, #64748b); }
.mon-perkwp { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--pv-ink-2, #475569); }
.mon-perkwp small { font-size: 9.5px; font-weight: 600; color: var(--pv-muted, #94a3b8); }
/* 昨日ラベル（大きな値の主体が昨日であることを明示） */
.mon-daylbl { font-size: 10px; font-weight: 700; color: var(--pv-muted, #94a3b8); letter-spacing: .04em; }
/* 本日ここまで（速報・進行中）— 昨日の値より控えめに、でも読める緑で */
.mon-card-today { display: flex; align-items: baseline; gap: 5px; margin-top: 5px;
  font-size: 11.5px; font-weight: 700; color: var(--pv-muted, #64748b); font-variant-numeric: tabular-nums; }
.mon-card-today b { font-size: 13.5px; font-weight: 800; color: var(--pv-green-700, #00734f); }
.mon-card-today .u { font-size: 10px; font-weight: 600; color: var(--pv-muted, #94a3b8); }
.mon-card-today small { margin-left: auto; font-size: 9px; font-weight: 700; color: var(--pv-green-600, #059669);
  background: var(--pv-green-50, #ecfdf5); border-radius: 999px; padding: 1px 6px; }
/* 一覧の本日列は速報の現在値なので緑で少し強調 */
.mon-hm-today { color: var(--pv-green-700, #00734f); font-weight: 700; }
/* 本日 = 表内で唯一まだ動いている速報値。淡緑チップで一目で分かるように強調 */
.mon-today-chip { display: inline-block; padding: 1px 7px; border-radius: 999px;
  background: #ecfdf5; color: var(--pv-green-700, #00734f); font-weight: 800; }
.mon-hm-th-today { color: var(--pv-green-700, #00734f) !important; }

/* ── 当日天気・日射（Open-Meteo） ── */
/* カード: 名称の下の天気チップ。日射を主役に。 */
.mon-wx { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin: 3px 0 6px;
  font-size: 11.5px; color: var(--pv-ink-2, #475569); }
.mon-wx-ic { font-size: 14px; line-height: 1; }
.mon-wx-label { font-weight: 700; color: var(--pv-ink, #0f172a); }
.mon-wx-temp { color: var(--pv-muted, #64748b); font-variant-numeric: tabular-nums; }
.mon-wx-rad { margin-left: auto; font-size: 11px; color: var(--pv-muted, #64748b); font-variant-numeric: tabular-nums; }
.mon-wx-rad b { color: var(--pv-green-700, #00734f); font-weight: 800; }
/* ── 性能比 PR（日射で正規化した効率・杀手锏指标） ── */
.mon-pr--good { color: var(--pv-green-700, #00734f); }
.mon-pr--warn { color: #b45309; }
.mon-pr--danger { color: #b91c1c; }
.mon-pr--muted { color: var(--pv-muted, #94a3b8); }
.mon-card-pr { display: inline-flex; align-items: baseline; gap: 5px; margin-top: 4px;
  font-size: 11px; font-weight: 700; }
.mon-card-pr b { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mon-hm-pr b { font-variant-numeric: tabular-nums; }

/* 一覧: 天気/日射列（アイコン＋日射MJ） */
.mon-hm-wx { white-space: nowrap; color: var(--pv-ink-2, #475569); }
.mon-hm-wx b { color: var(--pv-green-700, #00734f); font-weight: 800; font-variant-numeric: tabular-nums; }
.mon-hm-wx small { font-size: 9px; color: var(--pv-muted, #94a3b8); margin-left: 1px; }
.mon-hm-wx-none { color: var(--pv-muted, #cbd5e1); }

/* スパークバー（直近14日・カード内相対） */
.mon-spark { display: flex; align-items: flex-end; gap: 2px; height: 34px; margin-top: 8px; }
.mon-bar { flex: 1; min-width: 3px; background: #34d399; border-radius: 2px 2px 0 0; }
.mon-bar:last-child { background: #00734f; }
.mon-bar.is-empty { background: #eef2f0; }
.mon-card--warn .mon-bar { background: #fca5a5; }
.mon-card--warn .mon-bar.is-empty { background: #f3e8e8; }

.mon-card-issues { margin-top: 6px; font-size: 10.5px; font-weight: 700; color: #b91c1c; }
.mon-note { margin-top: 14px; font-size: 11.5px; color: var(--pv-muted, #94a3b8); }
.mon-empty { border: 1px dashed var(--pv-border, #e5eae7); border-radius: 14px; padding: 28px;
  color: var(--pv-muted, #64748b); font-size: 13.5px; background: var(--pv-surface, #fff); }

@media (max-width: 900px) { .mon-kpis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) {
  .mon-grid { grid-template-columns: 1fr 1fr; }
  .mon-kpis { grid-template-columns: 1fr 1fr; }
  .mon-kpi .v { font-size: 20px; }
}

/* ── 紙面（罫線）レイアウト。方向B（2026-09-02 決定） ──
   カード格子は1座あたり枠と余白で30px超を使う。リスト行にして
   名前＋昨日kWhを1段目、状態・PR・本日を2段目に小さく置く。
   ヒートマップは行列そのものが価値なので横スクロールのまま触らない。 */
@media (max-width: 760px) {
  body.page-monitor { background: #ffffff; }
  .mon-grid { display: block; }
  .mon-card {
    display: flex; flex-wrap: wrap; align-items: baseline;
    column-gap: 10px; row-gap: 2px;
    border: 0; border-radius: 0; border-bottom: 1px solid var(--pv-border, #e6ebf0);
    background: transparent; box-shadow: none;
    padding: 12px 0; margin: 0;
  }
  .mon-card:first-child { border-top: 2px solid var(--pv-ink, #0f172a); }
  .mon-card:hover { box-shadow: none; border-color: var(--pv-border, #e6ebf0); }
  .mon-card:active { background: var(--pv-bg, #f6f9f8); }
  .mon-card > * { order: 5; }
  .mon-card-name { order: 1; flex: 1 1 50%; min-width: 0; font-size: 14px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; }
  .mon-card-val { order: 2; margin-left: auto; font-size: 17px;
    font-variant-numeric: tabular-nums; flex: 0 0 auto; }
  .mon-card-top { order: 3; flex: 0 0 auto; margin-bottom: 0; }
  .mon-card-pr, .mon-card-today, .mon-card-peak { order: 4; font-size: 11.5px; margin-top: 2px; }
  .mon-card-issues { order: 6; flex: 1 1 100%; font-size: 12px; }
  /* 異常のある座は帯で（枠色ではなく行の背景） */
  .mon-card--warn { background: var(--pv-danger-bg, #fef2f2); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .mon-card--warn:hover { border-color: var(--pv-border, #e6ebf0); }
}

/* 案B: ヒートマップ + タブ + 当日カーブ */
.mon-tabs { display: inline-flex; gap: 4px; border: 1px solid var(--pv-border, #e5eae7); border-radius: 10px;
  padding: 3px; background: var(--pv-surface, #fff); margin-bottom: 12px; }
.mon-tab { padding: 6px 18px; font-size: 13px; font-weight: 800; color: var(--pv-ink-2, #475569);
  text-decoration: none; border-radius: 7px; }
.mon-tab.on { background: #ecfdf5; color: #00734f; }
.mon-tab:hover:not(.on) { background: #f4f8f6; }
.mon-tab--edit { font-weight: 600; color: var(--pv-muted, #94a3b8); border-left: 1px solid var(--pv-border, #e5eae7); border-radius: 0 7px 7px 0; }
.mon-tab--edit:hover { color: var(--pv-green-700, #00734f); }
.mon-pin-form { display: contents; }
button.mon-tab { background: transparent; cursor: pointer; }
button.mon-tab:hover { color: #d97706; }
.mon-pin-mark { color: #d97706; font-size: 10px; }

.mon-curve-card { background: var(--pv-surface, #fff); border: 1px solid var(--pv-border, #e5eae7);
  border-radius: 14px; padding: 12px 18px 8px; margin-bottom: 14px; }
.mon-curve-head { font-size: 12px; font-weight: 800; color: var(--pv-ink, #0f172a); margin-bottom: 6px; }
.mon-curve-sub { font-size: 10.5px; font-weight: 600; color: var(--pv-muted, #64748b); margin-left: 8px; }
.mon-curve { display: flex; align-items: flex-end; gap: 3px; height: 72px; }
.mon-cbar { flex: 1; background: linear-gradient(180deg, #34d399, #00734f); border-radius: 3px 3px 0 0; min-height: 2px; }
.mon-cbar.is-empty { background: #eef2f0; }
.mon-curve-axis { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--pv-muted, #94a3b8); margin-top: 4px; }

.mon-hm-wrap { background: var(--pv-surface, #fff); border: 1px solid var(--pv-border, #e5eae7);
  border-radius: 14px; padding: 12px 14px; overflow-x: auto; }
.mon-hm { border-collapse: collapse; width: 100%; }
.mon-hm th { font-size: 9px; font-weight: 700; color: var(--pv-muted, #94a3b8); text-align: left; padding: 2px 3px; white-space: nowrap; }
.mon-hm th.mon-hm-d { text-align: center; }
/* 末尾の日付列 = 昨日。数値列を別に設けず、ヘッダーで示す */
.mon-hm th.mon-hm-d--y { color: var(--pv-ink, #0f172a); }
.mon-hm th.mon-hm-d--y small { display: block; font-size: 8px; font-weight: 700; color: var(--pv-muted, #94a3b8); }
.mon-hm td { padding: 1.5px 1px; }
.mon-hm tbody tr { cursor: pointer; }
.mon-hm tbody tr:hover td { background: #f4faf7; }
.mon-hm-row--warn .mon-hm-name { color: #b91c1c; }
.mon-hm-name { font-size: 11.5px; font-weight: 700; white-space: nowrap; max-width: 15em;
  overflow: hidden; text-overflow: ellipsis; padding-right: 10px !important; color: var(--pv-ink, #0f172a); }
.mon-hm-name .mon-health { margin-right: 6px; }
.mon-hm-num { font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap;
  padding-left: 10px !important; color: var(--pv-ink-2, #475569); }
/* 昨日グループ / 本日グループ の区切り */
.mon-hm-sep { border-left: 1px solid var(--pv-border, #e5eae7); }
/* セル内 = 日発電量（整数kWh）。背景色 = 行内相対の濃淡。
   「☁ 天気」トグルON時のみ上段に当日の天気アイコンを表示（既定OFF: 絵文字約500個で数字が霞むため） */
.mon-cell { display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  width: 100%; min-width: 30px; height: 17px; padding: 0 2px;
  border-radius: 4px; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.mon-cell-wxi { display: none; font-size: 10px; line-height: 1; margin-bottom: 1px; }
.show-wx .mon-cell { height: 29px; padding: 2px 2px 1px; line-height: 1.25; }
.show-wx .mon-cell-wxi { display: block; }
.mon-wx-toggle { border: none; background: transparent; font-family: inherit; cursor: pointer; }
.mon-wx-toggle.on { background: var(--pv-green-700, #00734f); color: #fff; }

/* FusionSolar 告警明細（要確認の内訳。ホバーで原因/対処） */
.mon-alarm-list { margin: 3px 0 2px; padding-left: 1.4em; list-style: none; }
.mon-alarm-list li { font-size: 11px; font-weight: 700; color: #b45309; cursor: help; padding: 1px 0; }
.mon-alarm-list small { margin-left: 6px; font-size: 10px; font-weight: 600; color: var(--pv-muted, #94a3b8); }

/* 組合タブ（顧客/バッチ単位の絞り込み）— 見出し行の右側に同居（高さを取らない） */
.mon-head { flex-wrap: wrap; }
.mon-gtabs { margin-bottom: 0; flex-shrink: 0; }
.mon-gcount { margin-left: 5px; font-size: 10px; font-weight: 700; color: var(--pv-muted, #94a3b8); }
.mon-tab.on .mon-gcount { color: inherit; }
.hm-0 { background: #e7f6ef; color: #4d8a6d; } .hm-1 { background: #b7e6cf; color: #1d5c40; }
.hm-2 { background: #6fcfa4; color: #073d29; }
.hm-3 { background: #2ba77a; color: #fff; } .hm-4 { background: #00734f; color: #fff; }
.hm-zero { background: #ef4444; color: #fff; } .hm-none { background: #f1f5f9; }
.mon-hm-legend { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--pv-muted, #64748b); margin-top: 8px; flex-wrap: wrap; }
.mon-hm-legend .mon-cell { display: inline-block; width: 16px; min-width: 16px; height: 11px; }

/* 公開ショーケース（/live）— 行リンクが無いので、押せるように見せない */
.mon-hm-bar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.mon-hm-wrap--static tbody tr { cursor: default; }
.mon-hm-wrap--static tbody tr:hover td { background: transparent; }

/* 滑らかな当日カーブ（SVG・共通） */
.pv-daycurve { display: block; width: 100%; height: 168px; }
.pv-dc-line { fill: none; stroke: #00734f; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.pv-dc-theo { fill: none; stroke: #86d9b6; stroke-width: 1.5; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.pv-dc-dot { fill: #00734f; stroke: #fff; stroke-width: 1.5; }
.pv-dc-grid { stroke: #e5eae7; stroke-width: 1; vector-effect: non-scaling-stroke; }
.pv-dc-max { font-size: 10px; font-weight: 700; fill: #94a3b8; }
/* カーブ + 左Y軸目盛り + 下X軸目盛り */
.ws-daycurve-wrap { display: flex; gap: 6px; align-items: stretch; }
.ws-dc-yaxis { display: flex; flex-direction: column; justify-content: space-between;
  height: 168px; flex: 0 0 auto; min-width: 40px; padding-right: 3px; text-align: right;
  font-size: 9.5px; line-height: 1; color: var(--pv-muted, #94a3b8);
  font-variant-numeric: tabular-nums; }
.ws-dc-plot { flex: 1 1 auto; min-width: 0; }

/* ピーク出力 / 定格（逆変器停止検知） */
.mon-peak b { font-variant-numeric: tabular-nums; }
.mon-peak small { display: block; font-size: 9px; font-weight: 600; color: var(--pv-muted, #94a3b8); }
.mon-peak--good b { color: #00734f; }
.mon-peak--warn b { color: #b45309; }
.mon-peak--danger b { color: #b91c1c; }
.mon-peak--muted { color: var(--pv-muted, #94a3b8); }
.mon-card-peak { margin-top: 6px; font-size: 11px; font-weight: 700; color: var(--pv-ink-2, #475569); }
.mon-card-peak b { font-size: 13px; }
.mon-card-peak.mon-peak--danger { color: #b91c1c; }
/* 2026-10-07: 出力制御の可能性など、異常ではない添え書き */
.mon-card-note { margin-top: 6px; font-size: 11.5px; color: var(--pv-muted); }
