.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background: #e9ece9;
  background-image: linear-gradient(115deg, rgba(255,255,255,.72), transparent 42%),
    linear-gradient(rgba(42,120,214,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42,120,214,.045) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
  animation: auth-in .45s ease both;
}

.auth-card {
  display: grid;
  grid-template-columns: minmax(230px, .9fr) minmax(300px, 1.1fr);
  width: min(900px, 100%);
  min-height: 440px;
  overflow: hidden;
  border: 1px solid rgba(11,11,11,.12);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(11,11,11,.16), 0 2px 8px rgba(11,11,11,.06);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 38px;
  color: #fff;
  background: #173b55;
  background-image: linear-gradient(145deg, rgba(42,120,214,.55), transparent 54%),
    linear-gradient(0deg, rgba(8,24,34,.18), rgba(8,24,34,.18));
}
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 52px 56px; }
.auth-kicker { margin: 0 0 14px; color: #2a78d6; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.auth-brand .auth-kicker { color: #9bd0ff; }
.auth-card h1 { margin: 0; font-size: clamp(30px, 4vw, 43px); letter-spacing: -.03em; }
.auth-card h2 { margin: 0 0 10px; font-size: 27px; letter-spacing: -.02em; }
.auth-brand-copy { max-width: 245px; margin: 14px 0 0; color: rgba(255,255,255,.76); font-size: 14px; line-height: 1.8; }
.auth-form > p:not(.auth-kicker):not(.auth-error) { margin: 0 0 28px; color: var(--ink-2); }
.auth-mark { display: grid; grid-template-columns: repeat(2, 12px); gap: 5px; width: max-content; margin-bottom: 40px; }
.auth-mark span { display: block; width: 12px; height: 12px; border-radius: 2px; background: #84c7f4; }
.auth-mark span:nth-child(2) { background: #f0a45b; }
.auth-mark span:nth-child(3) { background: #54c69a; }
.auth-mark span:nth-child(4) { background: rgba(255,255,255,.78); }
.auth-signal { display: flex; align-items: center; gap: 9px; color: rgba(255,255,255,.64); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.auth-signal i, .auth-footnote span { width: 7px; height: 7px; border-radius: 50%; background: #54c69a; box-shadow: 0 0 0 4px rgba(84,198,154,.15); }
.auth-login { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 46px; font-size: 13px; box-shadow: 0 8px 18px rgba(42,120,214,.22); }
.ms-symbol { display: grid; grid-template-columns: repeat(2, 8px); gap: 2px; }
.ms-symbol i { width: 8px; height: 8px; background: currentColor; }
.ms-symbol i:nth-child(2) { opacity: .78; }.ms-symbol i:nth-child(3) { opacity: .62; }.ms-symbol i:nth-child(4) { opacity: .9; }
.auth-error { min-height: 1.4em; margin: 12px 0 0; color: var(--crit); font-size: 12px; }
.auth-footnote { display: flex; align-items: center; gap: 9px; margin-top: 30px; color: var(--muted); font-size: 11px; }
.auth-user { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
@keyframes auth-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .auth-gate { padding: 14px; }
  .auth-card { grid-template-columns: 1fr; min-height: 0; }
  .auth-brand { min-height: 210px; padding: 28px; }
  .auth-mark { margin-bottom: 22px; }
  .auth-signal { margin-top: 26px; }
  .auth-form { padding: 34px 28px 30px; }
}
/* UghDataGraph — 建築設備エネルギー可視化 UI(中央監視システム)
   配色は dataviz スキルの検証済みリファレンスパレットに準拠。 */
:root {
  color-scheme: light;
  --page:        #f9f9f7;
  --surface:     #fcfcfb;
  --surface-2:   #f1f1ee;
  --ink:         #0b0b0b;
  --ink-2:       #52514e;
  --muted:       #898781;
  --grid:        #e1e0d9;
  --baseline:    #c3c2b7;
  --border:      rgba(11,11,11,0.10);
  --accent:      #2a78d6;
  --accent-weak: #cde2fb;
  --good:        #0ca30c;
  --warn:        #fab219;
  --crit:        #d03b3b;
  --shadow:      0 1px 2px rgba(11,11,11,.05), 0 4px 14px rgba(11,11,11,.05);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN",
          "Yu Gothic UI", Meiryo, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page:        #0d0d0d;
  --surface:     #1a1a19;
  --surface-2:   #232320;
  --ink:         #ffffff;
  --ink-2:       #c3c2b7;
  --muted:       #898781;
  --grid:        #2c2c2a;
  --baseline:    #383835;
  --border:      rgba(255,255,255,0.10);
  --accent:      #3987e5;
  --accent-weak: #184f95;
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Header ---- */
.appbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.appbar h1 {
  font-size: 15px; font-weight: 700; margin: 0; letter-spacing: .02em;
  display: flex; align-items: baseline; gap: 10px; white-space: nowrap;
}
.appbar h1 .sub { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.appbar .spacer { flex: 1; }
.controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ctl { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.ctl label { user-select: none; }

.btn {
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 13px; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: color-mix(in srgb, var(--accent) 12%, var(--surface-2)); }
.btn:active { transform: translateY(1px); }
.btn.primary { color: #fff; background: var(--accent); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button {
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  background: transparent; border: 0; padding: 6px 11px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.switch { position: relative; width: 34px; height: 19px; flex: none; cursor: pointer; }
/* input は 0x0 だと**見た目のスイッチに当たり判定が無く**、文字ラベルを押したときしか
   切り替わらなかった(ペースメーカー・合計線・テーマの3つとも)。
   スイッチ全体に重ねて、見えているところを押せば効くようにする。 */
.switch input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer; z-index: 2;
}
.switch .track {
  position: absolute; inset: 0; background: var(--baseline); border-radius: 999px;
  transition: background .15s; pointer-events: none;   /* クリックは input が受ける */
}
.switch .track::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
  background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(15px); }

select.input {
  font-family: inherit; font-size: 12.5px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 7px; padding: 5px 7px; cursor: pointer;
}

/* ---- Dropzone / file tray ---- */
.tray { padding: 14px 18px 4px; }
.dropzone {
  border: 1.5px dashed var(--baseline); border-radius: var(--radius);
  padding: 18px; text-align: center; color: var(--ink-2);
  background: var(--surface); transition: border-color .15s, background .15s;
  cursor: pointer;
}
.dropzone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.dropzone strong { color: var(--ink); }
.dropzone .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 12px;
  box-shadow: var(--shadow);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chip .code { font-weight: 700; }
.chip .meta { color: var(--muted); }
.chip select { font-size: 11px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-2); color: var(--ink-2); padding: 2px 4px; }
.chip .x { cursor: pointer; color: var(--muted); border: 0; background: transparent;
  font-size: 15px; line-height: 1; padding: 2px 5px; border-radius: 50%; }
.chip .x:hover { color: var(--crit); background: var(--surface-2); }

/* ---- Systems ---- */
main { padding: 8px 18px 60px; max-width: 1500px; margin: 0 auto; }
.system { margin-top: 22px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.system > header {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer; background: var(--surface);
}
.system > header .title { font-weight: 700; font-size: 14.5px; }
.system > header .code { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.system > header .badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border);
}
.system > header .spacer { flex: 1; }
.system > header .twist { color: var(--muted); transition: transform .15s; }
.system.collapsed > header .twist { transform: rotate(-90deg); }
.system.collapsed .system-body { display: none; }
.system-body { padding: 6px 14px 16px; }

.group { margin-top: 14px; }
.group > .ghead { display: flex; align-items: center; gap: 10px; margin: 6px 2px 2px; }
.group > .ghead .glabel { font-weight: 700; font-size: 13px; color: var(--ink); }
.group > .ghead .gsub { font-size: 11.5px; color: var(--muted); }

.panels { display: grid; grid-template-columns: 1fr; gap: 6px; }
.panels.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 1080px) { .panels.two { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 8px 2px; overflow-x: auto;   /* グラフを2倍幅にして横スクロール */
}
.panel .phead { display: flex; align-items: center; gap: 8px; padding: 2px 4px;
  position: sticky; left: 0; background: var(--surface); z-index: 2; width: fit-content; }
.panel .phead .pname { font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.panel .phead .punit { font-size: 11px; color: var(--muted); white-space: nowrap; }
.panel .phead .spacer { flex: 1; }
/* グラフ本体はカード幅にフィット(1.0倍・横スクロールなし)。カードは画面全幅。 */
.panel .chart { width: 100%; height: 400px; }
.panel.tall .chart { height: 470px; }
/* 温湿度は10パネル並ぶため1枚あたりを低くする */
.panel.env .chart { height: 320px; }

/* グラフ本体から分離したHTML凡例(系列数が多いraw系統でもグラフを隠さない) */
.ext-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; max-height: 140px;
  overflow-y: auto; padding: 8px 4px 6px; margin-top: 4px; border-top: 1px solid var(--border); }
.ext-legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
  color: var(--ink-2); cursor: pointer; white-space: nowrap; user-select: none; }
.ext-legend-item:hover { color: var(--ink); }
.ext-legend-item.off { color: var(--muted); text-decoration: line-through; opacity: .6; }
.ext-legend-swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty svg { opacity: .5; }
.empty.loading .sub { font-size: 11px; opacity: .75; margin-top: 4px; }
.spinner { width: 30px; height: 30px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent); animation: hsc-spin .8s linear infinite; }
@keyframes hsc-spin { to { transform: rotate(360deg); } }
.errbox { margin: 12px 0; padding: 10px 14px; border-radius: 8px;
  background: color-mix(in srgb, var(--crit) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--crit) 40%, var(--border)); color: var(--ink); font-size: 12.5px; }

.toast-wrap { position: fixed; bottom: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: var(--page); padding: 9px 14px; border-radius: 8px;
  font-size: 12.5px; box-shadow: var(--shadow); opacity: .96; }

.legend-note { font-size: 11px; color: var(--muted); padding: 2px 6px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== v2: viewer layout (sidebar + main) ===== */
.layout { display: grid; grid-template-columns: 340px minmax(0, 1fr) 380px; align-items: start; }
.sidebar {
  position: sticky; top: 52px; align-self: start; height: calc(100vh - 52px); overflow-y: auto;
  border-right: 1px solid var(--border); background: var(--surface); padding: 12px 12px 40px;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; overflow: visible; border-right: none; border-bottom: 1px solid var(--border); }
  .weekbar { position: static; }
  .calendar { grid-template-columns: repeat(4, 1fr); }
}
.side-sec { margin-bottom: 16px; }
.side-sec > .lbl { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; margin: 0 2px 6px; display: flex; align-items: center; gap: 8px; }
.side-sec > .lbl .spacer { flex: 1; }
.slot-note { font-size: 10.8px; color: var(--muted); margin: 0 2px 8px; }
.slot-row { display: grid; grid-template-columns: 48px 1fr auto; gap: 6px 8px; align-items: center; margin-bottom: 6px; }
.slot-row .slot-label { font-size: 11px; color: var(--ink-2); }
.slot-row .btn { justify-self: start; }
.slot-selectmeta { display: flex; align-items: center; gap: 8px; margin-top: 2px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.slot-selectmeta > span { font-family: inherit; max-width: 100%; overflow-wrap: anywhere; }
.slot-selectmeta .btn { margin-left: auto; }

.dropzone.mini { padding: 12px; font-size: 12px; }
.dropzone.mini .hint { font-size: 10.5px; }

select.wide { width: 100%; }
.sysmeta { font-size: 11px; color: var(--muted); margin: 6px 2px 0; line-height: 1.4; }

/* ===== 温湿度 平面ヒートマップ ===== */
.heat-viewbar {
  display: flex; align-items: center; gap: 10px; margin: 10px 0 4px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface);
}
.heat-viewlabel { font-size: 12px; font-weight: 700; }
.heat-viewnote { font-size: 11px; color: var(--muted); }
.heat-panel {
  margin-top: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); min-width: 0; max-width: 100%;
}
.heat-toolbar, .heat-time, .heat-editor {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.heat-toolbar { padding: 2px 2px 8px; }
.heat-present { margin-left: auto; }
.heat-time { padding: 8px 2px; border-top: 1px solid var(--border); }
.heat-time strong { min-width: 190px; font-variant-numeric: tabular-nums; font-size: 13px; }
.heat-range { flex: 1; min-width: 260px; accent-color: var(--accent); }
.heat-editor {
  margin: 2px 0 9px; padding: 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  font-size: 12px;
}
.heat-edit-note { color: var(--muted); margin-right: auto; }
.heat-body { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 10px; align-items: start; }
.heat-body-compact { grid-template-columns: minmax(360px, 610px) 190px; justify-content: start; }
.heat-stage {
  position: relative; width: 100%; overflow: hidden; line-height: 0; user-select: none;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.heat-plan { display: block; width: 100%; height: auto; }
.heat-canvas, .heat-markers { position: absolute; inset: 0; width: 100%; height: 100%; }
.heat-canvas { pointer-events: none; }
.heat-markers { pointer-events: none; }
.heat-marker {
  --marker-color: #898781;
  position: absolute; transform: translate(-50%, -50%); border: 0; padding: 0;
  background: transparent; color: #151515; line-height: 1.1; pointer-events: auto;
  cursor: default; z-index: 2; font-family: var(--font);
}
.heat-editor + .heat-body .heat-stage { cursor: crosshair; }
.heat-editor + .heat-body .heat-marker { cursor: pointer; }
.heat-dot {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  width: 13px; height: 13px; border-radius: 50%; background: var(--marker-color);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45);
}
.heat-marker.selected .heat-dot { width: 19px; height: 19px; outline: 2px solid var(--accent); outline-offset: 2px; }
.heat-marker.missing .heat-dot { background: #898781; opacity: .65; }
.heat-marker-label {
  position: absolute; left: 9px; top: -8px; display: flex; align-items: baseline; gap: 4px;
  white-space: nowrap; padding: 2px 4px; border-radius: 3px;
  background: rgba(255,255,255,.74); text-shadow: 0 1px 0 #fff;
}
.heat-marker-label b { font-size: 9.5px; }
.heat-marker-label small { font-size: 9px; font-variant-numeric: tabular-nums; }
.heat-legend {
  padding: 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); position: sticky; top: 64px;
}
.heat-legend-top { display: flex; flex-direction: column; gap: 3px; color: var(--ink-2); font-size: 11px; }
.heat-legend-top span:first-child { font-weight: 700; color: var(--ink); }
.heat-gradient {
  height: 18px; margin-top: 12px; border-radius: 4px;
  background: linear-gradient(90deg, rgb(42,120,214), rgb(248,248,245), rgb(224,62,55));
  border: 1px solid var(--border);
}
.heat-legend-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-2); }
.heat-white-range {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 2px 8px;
  padding: 7px 9px; border-radius: 7px; background: var(--surface-2); font-size: 11.5px;
}
.heat-white-range input { width: 68px; }
.heat-week-box { max-width: 810px; margin-top: 8px; border: 1px solid var(--border); border-radius: 7px; padding: 6px; }
.heat-week-title { font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
.heat-week-graph { display: block; width: 100%; height: 105px; cursor: crosshair; }
.heat-snapshot-note { margin: 2px 0 7px; color: var(--muted); font-size: 11px; }
.heat-snapshot-scroll { overflow: auto; width: 100%; min-width: 0; max-width: 100%; max-height: 76vh;
  border: 1px solid var(--border); border-radius: 8px; }
.heat-snapshot-grid {
  display: grid; grid-template-columns: 64px repeat(12, 112px); grid-template-rows: 25px repeat(7, 126px);
  gap: 1px; min-width: 1419px; padding: 3px; background: var(--border);
}
.heat-snapshot-corner, .heat-snapshot-head, .heat-snapshot-day {
  display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2);
  font-size: 10px; font-weight: 700; white-space: pre-line; text-align: center;
}
.heat-snapshot { position: relative; overflow: hidden; border: 0; padding: 0; cursor: pointer;
  background-color: #fff; background-repeat: no-repeat; }
.heat-snapshot:hover { outline: 2px solid var(--accent); z-index: 2; }
.heat-snapshot canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.heat-snapshot-meta { position: absolute; right: 2px; bottom: 2px; padding: 1px 3px;
  border-radius: 3px; background: rgba(255,255,255,.78); color: #333; font-size: 8px; }
.heat-snapshot-legend { position: static; max-width: 440px; margin-top: 7px; }
.heat-caution {
  margin-top: 8px; padding: 7px 9px; color: var(--muted); background: var(--surface-2);
  border-radius: 6px; font-size: 11px; line-height: 1.45;
}
@media (max-width: 1050px) {
  .heat-body { grid-template-columns: 1fr; }
  .heat-body-compact { grid-template-columns: minmax(0, 610px); }
  .heat-legend { position: static; }
  .heat-viewnote { display: none; }
  .heat-present { margin-left: 0; }
}

/* calendar */
.cal-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cal-toolbar .yr { font-weight: 700; font-size: 13px; min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; }
.cal-toolbar .nav { cursor: pointer; border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 6px; width: 24px; height: 24px; display: grid; place-items: center; color: var(--ink-2); }
.cal-toolbar .nav:hover { background: var(--accent); color: #fff; }
.selseg { margin-left: auto; }
.calendar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 900px) { .calendar { grid-template-columns: repeat(4, 1fr); } }
.mon { border: 1px solid var(--border); border-radius: 7px; padding: 4px 4px 6px; background: var(--surface); }
.mon .mh { font-size: 10.5px; font-weight: 700; color: var(--ink-2); text-align: center; margin-bottom: 2px; }
.mon table { width: 100%; border-collapse: collapse; }
.mon td { text-align: center; font-size: 8.5px; line-height: 1; padding: 0; height: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums; }
.mon td.dow { color: var(--muted); opacity: .6; font-size: 7.5px; height: 10px; }
.mon td.day { color: var(--ink-2); border-radius: 2px; cursor: pointer; }
.mon td.day:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.mon td.has { color: var(--ink); font-weight: 700; }
.mon td.has::after { content: ""; display: block; height: 2px; margin: 0 2px; border-radius: 1px; background: var(--accent); }
.mon td.has:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.mon td.future { opacity: .35; cursor: not-allowed; }
.mon td.future:hover { background: none; }
.mon td.wkmain { background: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--ink); }
.mon td.wkcmp { background: color-mix(in srgb, var(--warn) 34%, transparent); color: var(--ink); }

/* data list */
.dlsearch { width: 100%; margin-bottom: 6px; }
.datalist { max-height: 230px; overflow-y: auto; border: 1px solid var(--border); border-radius: 7px; }
.datalist table { width: 100%; border-collapse: collapse; font-size: 11px; }
.datalist th { position: sticky; top: 0; background: var(--surface-2); color: var(--ink-2); font-weight: 700;
  text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.datalist td { padding: 3px 6px; border-bottom: 1px solid var(--border); color: var(--ink-2); white-space: nowrap; }
.datalist tr { cursor: pointer; }
.datalist tr:hover td { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--ink); }
.datalist .dcode { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* week header + main */
main.view { padding: 0 18px 60px; max-width: none; min-width: 0; margin: 0; }   /* auto余白を打ち消しグリッド全幅に */
.weekbar { position: sticky; top: 52px; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; background: color-mix(in srgb, var(--page) 92%, transparent); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.weekbar .sysname { font-weight: 700; font-size: 15px; }
.weekbar .syscode { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.weekbar .range { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.weekbar .cmp { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; font-weight: 600;
  background: color-mix(in srgb, var(--warn) 22%, var(--surface-2)); color: var(--ink-2); }
.weekbar .spacer { flex: 1; }
.wk-nav { display: inline-flex; gap: 4px; }
.wk-nav button { cursor: pointer; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-2);
  border-radius: 7px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.wk-nav button:hover { background: var(--accent); color: #fff; }
.wk-nav button:disabled { opacity: .4; cursor: default; }
.wk-nav button:disabled:hover { background: var(--surface-2); color: var(--ink-2); }

/* ---- 用途圧縮ビュー: 日別内訳テーブル ---- */
.dtable-wrap { overflow-x: auto; padding: 2px 4px 8px; }
.dtable { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.dtable th, .dtable td { padding: 4px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.dtable thead th { position: sticky; top: 0; background: var(--surface); color: var(--ink2);
  font-weight: 600; text-align: left; }
.dtable td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dtable td.num .pct { display: inline-block; min-width: 44px; color: var(--muted); font-size: 10.5px; }
.dtable .sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px;
  border: 1px solid var(--grid); vertical-align: -1px; }

/* ============ グラフのピン留め ============ */
/* ピン留めしたグラフは系統を切り替えても画面上部に残る(解除するまで)。 */
.group.pinned { border: 1px solid var(--accent); border-radius: 10px; padding: 4px 6px 6px;
  background: color-mix(in srgb, var(--accent) 4%, transparent); margin-top: 10px; }
.group.pinned > .ghead .glabel { color: var(--accent); }
.group.pinned > .ghead .pinclear { margin-left: auto; }
.phead .pinsrc { font-size: 10.5px; color: var(--muted); white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.phead .btn.xs { padding: 1px 7px; font-size: 10.5px; line-height: 18px; white-space: nowrap; }
.pinbtn { background: none; border: 1px solid transparent; border-radius: 6px; cursor: pointer;
  font-size: 13px; line-height: 1; padding: 2px 5px; opacity: .45; transition: opacity .12s; }
.pinbtn:hover { opacity: 1; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pinbtn[aria-pressed="true"] { opacity: 1; border-color: var(--accent); }
.pinempty { padding: 22px 8px; text-align: center; font-size: 12px; color: var(--muted); }

/* ============ 右サイドパネル(分析パネル) ============ */
/* レイアウトは [左サイドバー | グラフ | 右パネル] の3カラム。狭い画面では右パネルを畳む。 */
.layout { position: relative; }
.sidepanel {
  width: 380px; flex: 0 0 380px; border-left: 1px solid var(--border);
  background: var(--surface); display: flex; flex-direction: column;
  height: calc(100vh - var(--appbar-h, 52px)); position: sticky; top: var(--appbar-h, 52px);
  overflow: hidden;
}
body.sp-closed .sidepanel { display: none; }
body.sp-closed .layout { grid-template-columns: 340px minmax(0, 1fr); }
.sp-open {
  position: fixed; right: 10px; bottom: 12px; z-index: 40;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); font-size: 17px;
  box-shadow: 0 2px 10px rgba(0,0,0,.16);
}
.sp-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-bottom: 1px solid var(--border); }
.sp-title { font-weight: 700; font-size: 13px; color: var(--ink); }
.sp-x { margin-left: auto; border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 18px; line-height: 1; }
.sp-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--border); }
.sp-tab { flex: 1; border: 1px solid transparent; border-bottom: none; background: none;
  padding: 5px 4px; font-size: 12px; cursor: pointer; color: var(--ink2);
  border-radius: 6px 6px 0 0; }
.sp-tab.on { background: var(--surface); border-color: var(--border); color: var(--accent);
  font-weight: 700; }
.sp-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }

.sp-note { font-size: 11.5px; line-height: 1.55; color: var(--muted); }
.sp-note.bad { color: var(--warn, #c2410c); }
.sp-note code { font-size: 11px; background: var(--band, rgba(0,0,0,.05)); padding: 0 3px;
  border-radius: 3px; }
.sp-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 18px 6px; }
.sp-card { border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.sp-ch { font-size: 12px; font-weight: 700; color: var(--ink); margin: 2px 0 6px; }
.sp-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; font-size: 12px; }
.sp-kv .k { color: var(--muted); white-space: nowrap; }
.sp-kv .v { color: var(--ink); font-variant-numeric: tabular-nums; }
.sp-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sp-row > label { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sp-row .input { flex: 1; min-width: 90px; }

/* AIチャット */
.sp-chat { flex: 1; min-height: 160px; max-height: 46vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px; padding: 4px 2px; }
.sp-chat .msg { border-radius: 8px; padding: 7px 9px; font-size: 12px; line-height: 1.6; }
.sp-chat .msg.user { background: color-mix(in srgb, var(--accent) 12%, transparent);
  align-self: flex-end; max-width: 92%; }
.sp-chat .msg.ai { background: var(--band, rgba(0,0,0,.04)); }
.sp-chat .msg.sys { background: color-mix(in srgb, #f59e0b 14%, transparent);
  border: 1px solid color-mix(in srgb, #f59e0b 40%, transparent); }
.sp-chat .msg.pending { opacity: .65; font-style: italic; }
.sp-chat .msg.err { background: color-mix(in srgb, #dc2626 12%, transparent); }
.sp-chat .mtext { white-space: pre-wrap; word-break: break-word; }
.sp-chat .mmeta { margin-top: 4px; font-size: 10px; color: var(--muted); }
.sp-quick { display: flex; flex-wrap: wrap; gap: 4px; }
.sp-quick .chip { font-size: 11px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border); background: none; cursor: pointer; color: var(--ink2); }
.sp-quick .chip:hover { border-color: var(--accent); color: var(--accent); }
.sp-ask { display: flex; gap: 6px; align-items: flex-end; }
.sp-ask textarea { flex: 1; resize: vertical; font-family: inherit; font-size: 12px; }

/* 表 */
.sp-tablewrap { overflow: auto; max-height: 46vh; }
.sp-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.sp-table th, .sp-table td { border: 1px solid var(--border); padding: 3px 5px; text-align: left; }
.sp-table thead th { position: sticky; top: 0; background: var(--band, rgba(0,0,0,.05));
  z-index: 1; font-weight: 700; }
.sp-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sp-table tr.hol { background: color-mix(in srgb, #f59e0b 10%, transparent); }
.sp-table tr.warn { background: color-mix(in srgb, #dc2626 9%, transparent); }
.sp-table .wd { color: var(--muted); font-size: 10px; margin-left: 3px; }

/* 施設条件フォーム */
.sp-form { display: flex; flex-direction: column; gap: 3px; }
.sp-frow { display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: 6px; }
.sp-frow label { font-size: 11.5px; color: var(--ink2); }
.webiot-gate, .webiot-admin { display: flex; flex-direction: column; gap: 7px; }
.google-survey-admin { margin-top: 4px; }
.google-survey-admin textarea { resize: vertical; font-family: inherit; }
.sp-field-label { margin: 4px 0 -3px; font-size: 11.5px; color: var(--ink2); }
.webiot-check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink2); }
.webiot-actions { margin-top: 5px; flex-wrap: wrap; }
.webiot-status { display: flex; flex-direction: column; gap: 3px; }
.webiot-status-row { display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 3px 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  font-size: 11.5px; color: var(--muted); }
.webiot-status-row:last-child { border-bottom: 0; }
.webiot-status-row strong { color: var(--ink2); text-align: right; font-variant-numeric: tabular-nums; }
.webiot-api-error { margin-top: 6px; padding: 7px; border: 1px solid color-mix(in srgb, #dc2626 45%, var(--border));
  border-radius: 6px; background: color-mix(in srgb, #dc2626 8%, var(--surface)); color: #b42318;
  font-size: 11px; line-height: 1.5; word-break: break-word; }
.webiot-api-error strong { display: block; margin-bottom: 3px; }
.sp-md { white-space: pre-wrap; font-size: 11.5px; line-height: 1.65; max-height: 40vh;
  overflow-y: auto; }

/* ペースメーカーの表示タグ(週バー内) */
/* ペースメーカーは灰色 + 影(グラフの線と揃える) */
.weekbar .pmtag { font-size: 11.5px; padding: 1px 7px; border-radius: 999px;
  border: 1px dashed #6b7280; color: #6b7280; white-space: nowrap;
  box-shadow: 0 2px 5px rgba(17,24,39,.30); }
[data-theme="dark"] .weekbar .pmtag { border-color: #9ca3af; color: #9ca3af;
  box-shadow: 0 2px 6px rgba(0,0,0,.7); }

@media (max-width: 1400px) {
  .layout { grid-template-columns: 340px minmax(0, 1fr) 330px; }
  body.sp-closed .layout { grid-template-columns: 340px minmax(0, 1fr); }
  .sidepanel { width: 330px; flex-basis: 330px; }
}

@media (max-width: 900px) {
  .layout, body.sp-closed .layout { grid-template-columns: minmax(0, 1fr); }
  .sidepanel { width: 100%; height: auto; max-height: 80vh; position: static; }
}
@media (max-width: 1100px) {
  .sidepanel { position: fixed; right: 0; top: var(--appbar-h, 52px); z-index: 35;
    box-shadow: -4px 0 18px rgba(0,0,0,.18); }
}

/* 週バーの運転スケジュール表示 */
.weekbar .schedtag { font-size: 11.5px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid #0f766e; color: #0f766e; white-space: nowrap; }
[data-theme="dark"] .weekbar .schedtag { border-color: #2dd4bf; color: #2dd4bf; }
/* スケジュール表(設定タブ) */
.sched-grid { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 6px;
  font-size: 11.5px; align-items: center; }
.sched-grid .t { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sched-grid .z { color: var(--ink); }
.sched-grid .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.sched-grid .bulk { color: var(--accent); }

/* ============ 運転スケジュール(1時間スプレッド表) ============ */
/* グラフより数値表のほうが読みやすく、Excelへのコピペもしやすい。 */
.sched-host { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.sched-wrap { flex: 1 1 420px; min-width: 380px; }
.sched-bar { display: flex; align-items: center; gap: 8px; padding: 2px 2px 5px; }
.sched-bar .spacer { flex: 1; }
.sched-name { font-weight: 700; font-size: 12.5px; color: var(--ink); }
.sched-range { font-size: 11px; color: var(--muted); }
.sched-badge { font-size: 10px; padding: 1px 6px; border-radius: 999px;
  border: 1px solid var(--accent); color: var(--accent); }
.sched-tablewrap { overflow: auto; max-height: 560px; }
.sched-table { border-collapse: collapse; font-size: 11.5px; width: 100%; }
.sched-table th, .sched-table td { border: 1px solid var(--border); padding: 2px 6px;
  text-align: center; white-space: nowrap; }
.sched-table thead th { position: sticky; top: 0; z-index: 2;
  background: var(--band, rgba(0,0,0,.05)); font-weight: 700; font-size: 11px; }
.sched-table tbody th { position: sticky; left: 0; z-index: 1;
  background: var(--band, rgba(0,0,0,.05)); font-weight: 400; color: var(--muted);
  font-variant-numeric: tabular-nums; }
.sched-table td { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.sched-table td.stop { background: repeating-linear-gradient(45deg,
  transparent, transparent 4px, rgba(137,135,129,.10) 4px, rgba(137,135,129,.10) 8px); }
.sched-table tr.off tbody th, .sched-table tr.off th { color: var(--muted); opacity: .6; }
.sched-note { font-size: 11px; color: var(--muted); padding: 4px 2px 0; }
/* 編集グリッド(設定タブ) */
.sched-edit td input { width: 100%; min-width: 46px; border: none; background: none;
  text-align: center; font: inherit; color: var(--ink); font-variant-numeric: tabular-nums; }
.sched-edit td { padding: 0; }
.sched-edit td:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ============ 時間PUE.hsc の全面赤アラーム ============ */
/* 1時間前の時間PUE.hsc が閾値超のとき画面全体を赤にする。見落とさせないのが目的なので
   半端な色にせず、背景も枠も赤で振る。 */
.alarm-overlay { display: none; position: fixed; inset: 0; z-index: 9000;
  background: rgba(153, 27, 27, .93); align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto; }
body.alarm-on { overflow: hidden; }
body.alarm-on .appbar, body.alarm-on .layout { filter: saturate(.5) brightness(.65); }
.alarm-card { background: #7f1d1d; color: #fff; border: 3px solid #fecaca;
  border-radius: 14px; padding: 20px 22px; max-width: 720px; width: 100%;
  box-shadow: 0 18px 60px rgba(0,0,0,.5); animation: alarmPulse 1.6s ease-in-out infinite; }
@keyframes alarmPulse { 0%,100% { border-color: #fecaca; } 50% { border-color: #fff; } }
.alarm-head { font-size: 19px; font-weight: 800; letter-spacing: .02em; margin-bottom: 10px; }
.alarm-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 8px 0 12px; border-bottom: 1px solid rgba(255,255,255,.28); margin-bottom: 12px; }
.alarm-big .v { font-size: 52px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; }
.alarm-big .u { font-size: 14px; opacity: .9; }
.alarm-big .t { font-size: 13px; opacity: .85; margin-left: auto; }
.alarm-msg { font-size: 13.5px; line-height: 1.7; margin: 0 0 12px; }
.alarm-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px;
  font-size: 12.5px; margin-bottom: 12px; }
.alarm-kv .k { opacity: .8; white-space: nowrap; }
.alarm-kv .v { font-variant-numeric: tabular-nums; }
.alarm-cap { font-size: 11.5px; opacity: .85; margin-bottom: 5px; }
.alarm-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.alarm-table th, .alarm-table td { border: 1px solid rgba(255,255,255,.3);
  padding: 3px 7px; text-align: left; }
.alarm-table th { background: rgba(0,0,0,.22); font-weight: 700; }
.alarm-table td { font-variant-numeric: tabular-nums; }
.alarm-table td.new { font-weight: 800; color: #fde047; }
.alarm-btns { display: flex; justify-content: flex-end; margin-top: 14px; }
.alarm-btn { background: #fff; color: #7f1d1d; border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer; }
.alarm-btn:hover { background: #fee2e2; }
/* ヘッダの常時表示バッジ */
.alarm-badge { border: 1px solid var(--border); background: none; border-radius: 999px;
  padding: 2px 9px; font-size: 11.5px; cursor: pointer; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.alarm-badge.ok { border-color: #16a34a; color: #16a34a; }
.alarm-badge.alarm { border-color: #dc2626; color: #fff; background: #dc2626;
  font-weight: 700; animation: alarmBlink 1s steps(2, start) infinite; }
@keyframes alarmBlink { 50% { opacity: .55; } }

/* ============ 時刻別の横並び表(168列) ============ */
/* 列 = 週の各時刻。横スクロールで週全体を追う。系列名と時刻ヘッダは固定する。 */
.sched-wrap.wide { flex: 1 1 100%; min-width: 0; }
.wide-wrap { overflow: auto; max-height: 420px; border: 1px solid var(--border);
  border-radius: 6px; }
.wide-table { border-collapse: separate; border-spacing: 0; font-size: 10.5px; }
.wide-table th, .wide-table td { border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border); padding: 1px 3px; text-align: center;
  white-space: nowrap; font-variant-numeric: tabular-nums; }
.wide-table thead th { position: sticky; top: 0; z-index: 3;
  background: var(--band, rgba(0,0,0,.06)); font-weight: 700; }
.wide-table thead tr:nth-child(2) th { top: 19px; z-index: 3; font-weight: 400;
  color: var(--muted); font-size: 9.5px; min-width: 17px; }
.wide-table th.dayhead { font-size: 11px; color: var(--ink); }
.wide-table th.sticky, .wide-table tbody th.sticky { position: sticky; left: 0; z-index: 4;
  background: var(--surface); text-align: left; font-weight: 400; color: var(--ink);
  max-width: 168px; overflow: hidden; text-overflow: ellipsis;
  border-right: 2px solid var(--border); padding-right: 6px; }
.wide-table thead th.sticky { z-index: 5; background: var(--band, rgba(0,0,0,.06)); }
.wide-table td { color: var(--ink); }
.wide-table .dayedge { border-left: 2px solid var(--baseline, #c3c2b7); }
.wide-table td.stop { background: repeating-linear-gradient(45deg,
  transparent, transparent 3px, rgba(137,135,129,.12) 3px, rgba(137,135,129,.12) 6px); }
.wide-table td.hot1 { background: rgba(235,104,52,.16); }
.wide-table td.hot2 { background: rgba(235,104,52,.30); }
.wide-table td.cool1 { background: rgba(42,120,214,.16); }

/* 6〜21時の16列だけなので横スクロール不要。テーブル幅をパネルに合わせる。 */
.wide-wrap.nofit { overflow: visible; max-height: none; }
.wide-table.fit { width: 100%; table-layout: fixed; font-size: 11.5px; }
.wide-table.fit th.sticky { position: static; width: 180px; max-width: 180px;
  font-size: 11px; }
.wide-table.fit th.hr { font-size: 11px; color: var(--muted); font-weight: 400; }
.wide-table.fit td { padding: 2px 1px; font-weight: 700; }
@media (max-width: 1500px) {
  .wide-table.fit { font-size: 10.5px; }
  .wide-table.fit th.sticky { width: 130px; max-width: 130px; font-size: 10px; }
}

/* 曜日別スケジュール: 7日分を縦に並べる(1枚ずつは横スクロール不要な16列) */
.sched-host.days7 { flex-direction: column; gap: 8px; }
.sched-host.days7 .sched-wrap { flex: 1 1 100%; }
.sched-host.days7 .sched-bar { padding-bottom: 3px; }
.sched-host.days7 .sched-note { display: none; }
.sched-host.days7 .sched-wrap:last-child .sched-note { display: block; }
.wdseg button { min-width: 26px; padding: 3px 4px; font-size: 11.5px; }

/* 運転スケジュールの手打ち編集 */
.sched-wrap.editing { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.sched-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 2px; font-size: 12px; }
.sched-tools .lbl { color: var(--muted); font-size: 11.5px; }
.sched-tools .spacer { flex: 1 1 auto; }
.sched-tools select.mini, .sched-tools input.mini {
  font: inherit; font-size: 11.5px; padding: 2px 4px; border: 1px solid var(--line);
  border-radius: 4px; background: var(--panel); color: var(--fg); }
.sched-tools input.num { width: 48px; text-align: center; }
.sched-tools .chk { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.wide-table.fit.edit td { padding: 1px; }
.wide-table.fit.edit input.cell {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 11.5px; font-weight: 700;
  text-align: center; padding: 2px 0; border: 1px solid transparent; border-radius: 3px;
  background: var(--panel); color: var(--fg); }
.wide-table.fit.edit input.cell:hover { border-color: var(--line); }
.wide-table.fit.edit input.cell:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(56,132,255,.25); }
.wide-table.fit.edit input.cell.stop { background: var(--bg); }

/* 運転スケジュール: 1項目=1行で1週間分(縦横スクロールなし) */
.sched-host.week1 { flex-direction: column; gap: 10px; }
.sched-host.week1 .sched-wrap { flex: 1 1 100%; }
.week-table { width: 100%; table-layout: fixed; border-collapse: collapse;
  font-size: 12px; }
.week-table th, .week-table td { border: 1px solid var(--line); padding: 2px 3px; }
.week-table thead th { background: var(--panel2, var(--bg)); font-weight: 600;
  vertical-align: top; }
.week-table th.sticky { width: 150px; max-width: 150px; text-align: left;
  font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.week-table th.day .dh { display: flex; align-items: center; gap: 4px;
  justify-content: center; }
.week-table th.day .dd { font-size: 11px; color: var(--muted); white-space: nowrap; }
.week-table th.day .btn.xs { padding: 0 6px; font-size: 10.5px; line-height: 16px;
  margin-top: 2px; }
.week-table td { text-align: center; vertical-align: middle; }
.week-table td .rn { display: flex; align-items: baseline; justify-content: center; gap: 3px; }
.week-table td .rn .v { font-weight: 700; font-size: 12.5px; }
.week-table td .rn .hr { font-size: 10px; color: var(--muted); }
.week-table td.multi .rn { font-size: 11px; }
.week-table td.multi .rn .v { font-size: 11.5px; }
.week-table td.stop .rn .v { font-weight: 400; color: var(--muted); }
.sched-badge.sm { font-size: 9.5px; padding: 0 4px; }
@media (max-width: 1500px) {
  .week-table { font-size: 11px; }
  .week-table th.sticky { width: 120px; max-width: 120px; font-size: 10.5px; }
}

/* 高さを半分にするパネル(温冷感アンケートなど) */
.panel.half .chart { height: 235px; }

/* スケジュール週表: 1セル1行に詰めて高さを半分にする */
.week-table thead th { padding: 1px 3px; }
.week-table td { padding: 1px 3px; }
.week-table td .rn { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.week-table td .rn .sep { color: var(--muted); font-size: 10px; margin: 0 1px; }
.week-table td.multi .rn .v { font-size: 10.5px; }
.week-table td.multi .rn .hr { font-size: 9px; }
.week-table th.day .dbtn { display: flex; gap: 2px; justify-content: center; }
.week-table th.day .btn.xs { padding: 0 5px; font-size: 10px; line-height: 15px; margin-top: 1px; }
.week-table th.sticky .zn { display: inline-block; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.wide-table.fit th.sticky .zn { max-width: calc(100% - 18px); }
.wide-table.fit th.sticky .zrm { padding: 0 4px; font-size: 10px; line-height: 14px;
  margin-left: 2px; }

/* 報告書タブ */
.appbar .viewseg { margin-left: 14px; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 12.5px;
  font-variant-numeric: tabular-nums; }
.rep-table th, .rep-table td { border: 1px solid var(--line); padding: 4px 8px; }
.rep-table thead th { background: var(--panel2, var(--bg)); font-size: 11.5px;
  color: var(--muted); font-weight: 600; white-space: nowrap; }
.rep-table th.lbl { text-align: left; font-weight: 700; white-space: nowrap; }
.rep-table td { text-align: center; }
.rep-table tr.unmade td, .rep-table tr.unmade th.lbl { color: var(--muted); }
.rep-table a.rep-dl { color: var(--accent); text-decoration: none; font-weight: 600; }
.rep-table a.rep-dl:hover { text-decoration: underline; }
.rep-table .rep-none { color: var(--muted); }
.rep-table tr.rep-err td { text-align: left; color: #b3201f; font-size: 11.5px;
  background: rgba(227,73,72,.08); }
/* 報告書タブでは右のAIパネルを畳んで表を広く使う */
body.view-reports .sidepanel { display: none; }
