/* 01MNT 設備GUI スタイル
   色はすべて :root の変数で定義し、[data-theme=light] で上書きする。 */
:root {
  color-scheme: dark;
  --bg: #060e1a; --panel: #0c1a29; --panel-a: #0e2030; --panel-b: #091623;
  --line: #23394d; --muted: #92a7bd; --text: #edf5ff; --text-strong: #e8f5ff;
  --blue: #39a4ff; --cyan: #48dfda; --amber: #ffbd53; --green: #65d99b; --accent: #1689f4;
  --primary: #087bd8; --primary-line: #299fff;
  --btn: #11263a; --btn-hover: #183850;
  --demo-line: #285b7e; --demo-text: #6dc6ff;
  --metric-bg: #0e2233; --metric-line: #243c50;
  --floor-bg: #092137; --floor-line: #49627b; --floor-stroke: #9ab3c9; --floor-grid: #7393b1;
  --zone-text: #b5c9da; --zone-bg: #071522a8;
  --device-bg: #061727df; --device-line: #437399; --device-text: #ffffff; --device-accent: #4ce0ff;
  --chart-text: #89a0b7; --chart-grid: #21364a;
  --pill-bg: #11382f; --pill-off-bg: #23313e; --bar-bg: #1e354b;
  --avatar-line: #2473b3; --weather: #e5c275;
  --energy-bg: #10304a; --energy-line: #376287;
  --footer: #6e849a; --toast-bg: #174a66; --toast-line: #43a9d5;
  --table-head: #0e2233; --shadow: 0 0 16px #1689f422;
}
[data-theme=light] {
  color-scheme: light;
  --bg: #eef3f8; --panel: #ffffff; --panel-a: #ffffff; --panel-b: #f6f9fc;
  --line: #d3dde8; --muted: #5f7186; --text: #13202e; --text-strong: #0b1826;
  --blue: #1a7fe0; --cyan: #0e9c97; --amber: #c7811a; --green: #1f9a5a; --accent: #1689f4;
  --primary: #1a7fe0; --primary-line: #1a7fe0;
  --btn: #f4f7fa; --btn-hover: #e2ebf4;
  --demo-line: #9cc4e4; --demo-text: #1f6fb8;
  --metric-bg: #f7f9fc; --metric-line: #dbe4ee;
  --floor-bg: #e6edf5; --floor-line: #b9c8d8; --floor-stroke: #5b7390; --floor-grid: #5b7390;
  --zone-text: #28405a; --zone-bg: #ffffffc0;
  --device-bg: #ffffffee; --device-line: #7ea3c6; --device-text: #13202e; --device-accent: #0d6fc9;
  --chart-text: #5f7186; --chart-grid: #d8e1ea;
  --pill-bg: #dff5e8; --pill-off-bg: #e6ebf1; --bar-bg: #dbe4ee;
  --avatar-line: #7eb0dd; --weather: #b58722;
  --energy-bg: #f1f6fb; --energy-line: #b8cde2;
  --footer: #6b7d91; --toast-bg: #1f4f73; --toast-line: #4a9fd6;
  --table-head: #f1f5f9; --shadow: 0 2px 10px #1a7fe022;
}
[data-theme=light] #toast { color: #fff; }
[data-theme=light] nav button.active, [data-theme=light] .primary { color: #fff; }
[data-theme=light] .device.person span { color: #13202e !important; }
[data-theme=light] .floor .heat { opacity: .5; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, 'Noto Sans JP', 'Yu Gothic', sans-serif; font-size: 16px; }
button, select, input { font: inherit; }
button, select { color: inherit; border: 1px solid var(--line); background: var(--btn); border-radius: 6px; padding: 9px 14px; cursor: pointer; }
button:hover { border-color: var(--blue); background: var(--btn-hover); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* ヘッダー・ナビ */
header { display: flex; align-items: center; gap: 24px; padding: 22px 32px; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 12px; font-size: 24px; font-weight: 600; align-items: center; letter-spacing: .03em; }
.brandlogo { height: 46px; width: auto; display: block; margin: -4px 0; }
.brandlogo.onlight, [data-theme=light] .brandlogo.ondark { display: none; }
[data-theme=light] .brandlogo.onlight { display: block; }
.brand > div { border-left: 1px solid var(--line); padding-left: 14px; }
.brand small { display: block; font-size: 10px; letter-spacing: .18em; color: var(--muted); margin-top: 3px; }
.demo { font-size: 12px; border: 1px solid var(--demo-line); color: var(--demo-text); padding: 6px 10px; border-radius: 4px; }
.place { margin-left: auto; color: var(--muted); font-size: 14px; }
.headtools { display: flex; gap: 6px; }
.pagelink { font-size: 12px; color: var(--demo-text); text-decoration: none; border: 1px solid var(--demo-line); border-radius: 6px; padding: 6px 10px; white-space: nowrap; }
.pagelink:hover { border-color: var(--blue); }
.headtools button { font-size: 12px; padding: 6px 10px; }
time { font-size: 25px; font-variant-numeric: tabular-nums; }
nav { display: flex; padding: 12px 32px; gap: 6px; border-bottom: 1px solid var(--line); overflow: auto; }
nav button { flex: 1; white-space: nowrap; background: transparent; font-size: 14px; }
nav button.active { background: var(--primary); border-color: var(--primary-line); box-shadow: var(--shadow); }

/* ページ共通 */
main { max-width: 1600px; margin: auto; padding: 24px 32px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.eyebrow { font-size: 11px; letter-spacing: .18em; color: var(--blue); }
h1 { font-size: 25px; margin: 5px 0 0; font-weight: 500; }
h2 { font-size: 16px; font-weight: 500; margin: 0; }
h3 { font-size: 15px; margin: 0 0 14px; }
.tools { display: flex; align-items: center; gap: 15px; font-size: 12px; color: var(--muted); }
.tools button { font-size: 13px; }
.layout { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(310px, 1fr); gap: 18px; }
.panel { background: linear-gradient(125deg, var(--panel-a), var(--panel-b)); border: 1px solid var(--line); border-radius: 10px; padding: 20px; min-width: 0; }
.panelhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 10px; }
.sub { font-size: 12px; color: var(--muted); }
.stack { display: grid; gap: 18px; align-content: start; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.metric { background: var(--metric-bg); border: 1px solid var(--metric-line); border-radius: 8px; padding: 17px; }
.metric .label { font-size: 13px; color: var(--muted); }
.metric .value { font-size: 31px; font-weight: 400; letter-spacing: -.025em; margin: 10px 0 6px; font-variant-numeric: tabular-nums; }
.unit { font-size: 14px; margin-left: 5px; color: var(--muted); }
.good { color: var(--green); font-size: 12px; }
.warn { color: var(--amber); }

/* フロア図 */
.floor { position: relative; aspect-ratio: 1.8; overflow: hidden; border: 1px solid var(--floor-line); background: var(--floor-bg); border-radius: 4px; }
.floor svg { width: 100%; height: 100%; position: absolute; inset: 0; }
.floor .geo { stroke: var(--floor-stroke); opacity: .52; }
.floor .floorgrid { stroke: var(--floor-grid); stroke-opacity: .12; }
.floor .heat { position: absolute; inset: 0; opacity: .64; background: radial-gradient(ellipse at 83% 30%, #f97528 0%, #e9c63699 15%, transparent 37%), radial-gradient(ellipse at 47% 56%, #b1d735 0%, #21aa7599 24%, transparent 46%), radial-gradient(ellipse at 15% 55%, #0088cc 0%, transparent 55%); filter: blur(12px); }
.floor.people .heat { background: radial-gradient(ellipse at 77% 37%, #f87d18 0%, #84c62688 19%, transparent 43%), radial-gradient(ellipse at 33% 63%, #068aff 0%, transparent 50%); }
.zone { position: absolute; color: var(--zone-text); font-size: 12px; background: var(--zone-bg); padding: 5px 8px; pointer-events: none; }
.device { position: absolute; transform: translate(-50%, -50%); padding: 5px 8px; font-size: 12px; background: var(--device-bg); border: 1px solid var(--device-line); color: var(--device-text); z-index: 2; min-width: 51px; }
.device b { display: block; color: var(--device-accent); font-size: 18px; font-weight: 400; }
.device.selected { border-color: #72e9ff; box-shadow: 0 0 0 3px #32c8ff33; }
.device.off { opacity: .58; }
.device.person { min-width: 0; padding: 4px; border: 0; background: none; text-shadow: 0 0 10px #37d6ff; color: #82edff; font-size: 22px; }
.floorlegend { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.gradient { width: 110px; display: inline-block; height: 5px; vertical-align: middle; background: linear-gradient(90deg, #0095ee, #44cf9c, #eccc3c, #f3652e); margin: 0 7px; }
.summary { display: flex; justify-content: space-around; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.summary strong { color: var(--text-strong); font-size: 21px; font-weight: 400; }

/* グラフ */
.chart { width: 100%; height: 150px; display: block; }
.chart text { fill: var(--chart-text); font-size: 11px; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.legend { display: flex; gap: 18px; justify-content: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 16px; height: 2px; background: var(--blue); vertical-align: middle; margin-right: 6px; }

/* コントロール */
.controltop { display: flex; align-items: center; justify-content: space-between; margin: 20px 0; }
.pill { font-size: 12px; background: var(--pill-bg); color: var(--green); padding: 5px 9px; border-radius: 20px; }
.pill.off { color: var(--muted); background: var(--pill-off-bg); }
.setpoint { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.setpoint strong { font-size: 52px; font-weight: 300; }
.setpoint button { font-size: 24px; width: 45px; height: 45px; padding: 0; }
.field { margin: 18px 0; }
.field label { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.field select { width: 100%; }
input[type=range] { width: 100%; accent-color: var(--blue); }
.primary { background: var(--primary); border-color: var(--primary-line); }
.full { width: 100%; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }
.info { font-size: 12px; color: var(--muted); line-height: 1.8; margin: 14px 0 0; }
.row { display: flex; justify-content: space-between; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.row:last-child { border: 0; }
.bar { height: 6px; background: var(--bar-bg); border-radius: 5px; margin-top: 10px; overflow: hidden; }
.bar span { display: block; background: var(--blue); height: 100%; }

/* ウェルカム・アラート・電力 */
.visitors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.visitor { padding: 16px 10px; text-align: center; border: 1px solid var(--line); border-radius: 7px; }
.avatar { width: 38px; height: 38px; border: 1px solid var(--avatar-line); border-radius: 50%; display: grid; place-items: center; color: var(--blue); margin: 0 auto 12px; }
.visitor p { font-size: 14px; margin: 6px; }
.weather { display: flex; justify-content: space-around; text-align: center; padding: 20px 0; gap: 10px; }
.weather b { font-size: 28px; display: block; margin: 15px 0; color: var(--weather); }
.weather span { font-size: 13px; color: var(--muted); }
.alert { display: grid; grid-template-columns: 65px 1fr auto; gap: 16px; padding: 19px 0; border-bottom: 1px solid var(--line); align-items: center; }
.alert p { margin: 5px 0; font-size: 12px; color: var(--muted); }
.alert button { font-size: 13px; }
.energy { display: grid; grid-template-columns: 1fr 60px 1fr; align-items: center; text-align: center; min-height: 330px; gap: 20px; }
.energybox { padding: 24px 12px; border: 1px solid var(--energy-line); background: var(--energy-bg); border-radius: 12px; }
.energybox strong { display: block; font-size: 33px; font-weight: 400; margin-top: 12px; }
.energyarrow { color: var(--cyan); font-size: 38px; }
.energybox.solar { border-color: #8e7834; color: var(--amber); }
.energybox.battery { border-color: #328467; color: var(--green); }
.minimetric { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.minimetric .metric .value { font-size: 24px; }

/* 履歴・日報 */
.tablewrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th, .table td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); }
.table th { background: var(--table-head); color: var(--muted); font-weight: 500; position: sticky; top: 0; }
.table th:first-child, .table td:first-child { text-align: left; }

/* フッター・トースト */
footer { max-width: 1600px; margin: auto; padding: 10px 32px 25px; display: flex; justify-content: space-between; font-size: 11px; color: var(--footer); }
#toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); border: 1px solid var(--toast-line); padding: 12px 24px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 8; font-size: 14px; }
#toast.show { opacity: 1; }
#signagehint { display: none; }

/* サイネージ表示：ナビ・操作類を隠し、大画面向けに拡大して自動巡回 */
body.signage nav, body.signage .tools, body.signage .headtools, body.signage footer { display: none; }
body.signage { overflow: hidden; }
body.signage header { padding: 16px 40px; }
body.signage main { max-width: none; padding: 24px 40px; zoom: 1.3; }
body.signage .pagehead { margin-bottom: 16px; }
body.signage #signagehint { display: block; position: fixed; right: 16px; bottom: 12px; font-size: 11px; color: var(--muted); opacity: .7; z-index: 7; }
@media (min-width: 2200px) { body.signage main { zoom: 1.8; } }
@media (max-width: 1400px) { body.signage main { zoom: 1.05; } }

@media (min-width: 1500px) { .floor { aspect-ratio: 1.95; } .chart { height: 170px; } }
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .stack .metrics { grid-template-columns: repeat(3, 1fr); }
  nav { padding: 12px 16px; }
  main { padding: 20px 16px; }
  header { padding: 18px 16px; gap: 12px; }
  .place { display: none; }
  .demo { margin-left: auto; }
  .floor { aspect-ratio: 1.65; }
}
@media (max-width: 600px) {
  header { flex-wrap: wrap; }
  .brand { font-size: 20px; }
  .brandlogo { height: 38px; }
  .brand > div { padding-left: 10px; }
  time { font-size: 19px; }
  .demo { font-size: 10px; }
  .headtools { order: 5; width: 100%; }
  .pagehead { align-items: flex-start; gap: 10px; }
  .tools { flex-direction: column; gap: 5px; align-items: flex-end; }
  .tools span { display: none; }
  h1 { font-size: 22px; }
  .panel { padding: 14px; }
  .floor { aspect-ratio: 1.3; }
  .device { font-size: 10px; min-width: 38px; padding: 4px; }
  .device b { font-size: 15px; }
  .zone { font-size: 10px; }
  .metrics, .stack .metrics { grid-template-columns: repeat(2, 1fr); }
  .minimetric { grid-template-columns: repeat(2, 1fr); }
  .summary { flex-wrap: wrap; }
  .floorlegend { flex-wrap: wrap; }
  .visitors { grid-template-columns: repeat(2, 1fr); }
  .alert { grid-template-columns: 45px 1fr; gap: 8px; }
  .alert button { grid-column: 2; }
  .weather { flex-wrap: wrap; }
  .energy { gap: 10px; grid-template-columns: 1fr 30px 1fr; }
  .energybox strong { font-size: 25px; }
  footer { display: block; line-height: 1.8; }
  .legend { gap: 8px; }
  .metric .value { font-size: 27px; }
}

/* ---- 本番：ログイン中の利用者・閲覧専用・ログイン画面 ---- */
.userchip { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; white-space: nowrap; }
body.readonly [data-act] { opacity: .45; cursor: not-allowed; }
.loginwrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.loginbox { width: min(380px, 100%); display: grid; gap: 16px; }
.loginbox .brandlogo { height: 46px; width: auto; }
.loginbox h1 { font-size: 20px; font-weight: 500; margin: 0; }
.loginbox label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.loginbox input { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.loginbox button { font-size: 15px; padding: 10px; }
.loginbox .err { color: var(--warn, #ffbd53); font-size: 13px; min-height: 1.2em; margin: 0; }
