/* ================================
   Reset CSS
   ================================ */
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code, del, dfn, em,
img, ins, kbd, q, samp, small, strong, sub,
sup, var, b, i, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend, table,
caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption,
figure, footer, header, hgroup, menu, nav,
section, summary, time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  vertical-align: baseline;
  background: transparent;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section { display: block; }
body {
  line-height: 1;
  font-family: var(--app-font-sans);
  color: #333;
}
ul, ol { list-style: none; }
blockquote, q { quotes: none; }
blockquote:before, blockquote:after,
q:before, q:after { content: ''; }
table { border-collapse: collapse; border-spacing: 0; }
a { text-decoration: none; color: inherit; }

/* ================================
   Global Layout & Scroll Behavior
   ================================ */
:root {
  --header-h: 56px;
  --page-bg: #f0f4f8;
  --header-bg: #f0f4f8;
  --text-color: #333;
  --brand: #4f8bc2;
  --row-gap: 32px;

  /* Lato優先のフォントスタック（日本語フォールバック含む）*/
  --app-font-sans: 'Lato',
                   'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Noto Sans JP', Meiryo,
                   system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                   'Helvetica Neue', Arial, sans-serif;
}
html {
  width: 100%;
  background-color: var(--page-bg);
  color: var(--text-color);
  font-size: 14px;
  font-family: var(--app-font-sans);
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background-color: var(--page-bg);
  color: var(--text-color);
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-top: 56px;
}
body:not(:has(> header)) { padding-top: 0; }
body::-webkit-scrollbar { width: 0; height: 0; }
body:has(> header) { padding-top: var(--header-h); box-sizing: border-box; }

main {
  min-height: calc(100svh - var(--header-h));
  box-sizing: border-box;
  padding: 14px 14px;
}

footer {
  text-align: center;
}

/* ================================
   Material Symbols
   ================================ */
/* ▼ FOUT/FOITガード：フォント準備までアイコン文字を非表示に */
html:not(.ms-ready) .material-symbols-sharp { visibility: hidden !important; }

.material-symbols-sharp {
  font-family: 'Material Symbols Sharp';
  font-weight: normal;
  font-style: normal;
  font-size: inherit;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ================================
   Header / Nav
   ================================ */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  z-index: 2000;
  background-color: var(--header-bg);
}
nav {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
}
nav ul {
  display: flex;
  gap: 14px;
  width: 100%;
  align-items: center;
  justify-content: flex-end;
}
nav li { display: flex; align-items: center; }
nav button, nav a#logoutLink {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
nav button:focus-visible, nav a#logoutLink:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
nav .material-symbols-sharp {
  font-variation-settings: 'wght' 400, 'GRAD' 0, 'FILL' 0, 'opsz' 24;
  font-size: 28px;
  color: #4f8bc2;
  cursor: pointer;
}

/* ================================
   Login Layout
   ================================ */
.login {
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  min-height: 100svh; width: 100%; box-sizing: border-box;
}
.login-box { text-align: center; width: 70%; }
.lock-icon {
  font-family: 'Material Symbols Sharp';
  font-variation-settings: 'wght' 200, 'GRAD' -25, 'FILL' 0, 'opsz' 24;
  font-weight: 200; font-size: 60px !important; color: var(--brand);
  display: block; margin-bottom: 20px;
}
.login-form { display: flex; flex-direction: column; gap: 20px; width: 100%; }
.login-form input[type="text"], .login-form input[type="password"] {
  width: 100%; padding: 10px 0; font-size: 16px; background-color: var(--page-bg);
  border: none; border-bottom: 2px solid var(--brand); color: #333; outline: none; text-align: left;
  -webkit-appearance: none; appearance: none; border-radius: 0; box-shadow: none; background-clip: padding-box;
}
.login-form input::placeholder { color: var(--brand); text-align: left; }
input:-webkit-autofill {
  background-color: var(--page-bg) !important;
  transition: background-color 50000s ease-in-out 0s;
  -webkit-text-fill-color: #333 !important;
  box-shadow: 0 0 0px 1000px var(--page-bg) inset;
}

/* ================================
   Logout Dialog
   ================================ */
.logout-dialog-overlay {
  display: none;
  position: fixed; z-index: 9999; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
}
.logout-dialog-overlay.active {
  display: grid;
  place-items: center;
}
.logout-dialog-box {
  background: #fff; border-radius: 8px; padding: 20px 30px; text-align: center;
  max-width: 300px; width: 90%; box-shadow: 0 0 10px rgba(0,0,0,0.3);
  margin: 0 auto;
}
.logout-dialog-box p { margin-bottom: 20px; font-size: 16px; color: #333; }
.logout-dialog-buttons { display: flex; justify-content: space-between; gap: 10px; margin: 0; padding: 0; list-style: none; }
.logout-dialog-buttons li { flex: 1 1 0; display: flex; }
.logout-dialog-buttons li button {
  flex: 1 1 auto; padding: 8px 0; border: none; border-radius: 4px; background-color: var(--brand); color: #fff; font-size: 14px; cursor: pointer;
}
.logout-dialog-buttons li button:hover { opacity: 0.85; }

/* ================================
   Screen Reader only
   ================================ */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ================================
   Input Base 調整
   ================================ */
input, textarea, select {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
  box-shadow: none;
  background-clip: padding-box;
  outline: none;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input::-ms-clear, input::-ms-reveal, input::-ms-expand { display: none; width: 0; height: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* ================================
   Data Input Page 共通
   ================================ */
.input {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
}
.input .note {
  font-size: 12px;
  color: #666;
  margin: 10px 0 14px 0;
}

/* 1段目：日付（左）／モード（右） */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.date-left { display: inline-flex; align-items: center; }
.date-display {
  color: var(--brand);
  font-weight: 700;
  background: transparent;
  border: none;
  padding: 4px 2px;
  cursor: pointer;
  font-size: 32px;
  font-size: clamp(28px, 7.2vw, 36px);
  line-height: 1.28;
  min-height: 44px;
  touch-action: manipulation;
}
.date-display::-webkit-inner-spin-button,
.date-display::-webkit-contacts-auto-fill-button,
.date-display::-webkit-clear-button { display: none; }
.date-display::-webkit-calendar-picker-indicator { opacity: 1; }
.date-display:disabled { opacity: .5; cursor: default; }

.mode-right .mode-label { color: var(--brand); font-weight: 700; }

/* 2・3段目グリッド */
.input .input-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--row-gap) 12px;
  margin-top: var(--row-gap);
  min-width: 0;
}
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  .input .input-grid { display: flex; flex-wrap: wrap; }
  .input .input-grid > .fl-group { width: 33.3333%; box-sizing: border-box; }
}

/* フローティングラベル */
.fl-group { position: relative; padding: 0 6px; min-width: 0; }
.fl-group input, .fl-group textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--brand);
  padding: 12px 0;
  font-size: 16px;
  color: #333;
  outline: none;
  padding-right: 2.2em;
  box-sizing: border-box;
}
.fl-group input.numeric { text-align: right; }
#oh_display { text-align: right; }
.fl-group input::placeholder, .fl-group textarea::placeholder {
  font-size: 12px; color: var(--brand); text-align: left; opacity: 1;
}
.fl-group input:focus::placeholder,
.fl-group textarea:focus::placeholder,
.fl-group.is-filled input::placeholder,
.fl-group.is-filled textarea::placeholder { color: transparent; }
.fl-group .flabel {
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  font-size: 16px; color: var(--brand); pointer-events: none;
  transition: transform .15s ease, font-size .15s ease, top .15s ease, opacity .15s ease, left .15s ease; opacity: 0;
}
.fl-group.is-filled .flabel, .fl-group input:focus + .flabel, .fl-group textarea:focus + .flabel {
  top: -8px; transform: none; font-size: 12px; opacity: 1;
}
/* 単位 */
.fl-group .unit {
  position: absolute; right: .2em; top: 50%; transform: translateY(-55%);
  font-size: 12px; color: #4f8bc2; pointer-events: none;
}

/* 3段目マーカー */
.input .input-grid.rows-gap { margin-top: var(--row-gap); }

/* 4段目（備考） */
.fl-group.full { grid-column: 1 / -1; margin-top: var(--row-gap); }
.fl-group textarea {
  min-height: 40px;
  line-height: 1.4;
  font-size: 16px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  resize: vertical;
  overflow: hidden;
  transition: min-height .15s ease;
}

/* ================================
   ボタン（全幅）
   ================================ */
.input .input-actions { margin-top: 18px; display: block; width: 100%; }
.input .input-actions button[type="submit"] {
  width: 100%; display: block; background-color: var(--brand); color: #fff;
  font-size: 16px; padding: 12px 0; border: none; border-radius: 6px; cursor: pointer; transition: opacity .2s ease;
}
.input .input-actions button[type="submit"]:hover { opacity: .9; }
.input .input-actions .danger { background-color: #d94f4f; }

/* ================================
   自前 DatePicker（IE等用）
   ================================ */
.dp-overlay {
  display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 9998;
  background: rgba(0,0,0,0.5); text-align: center;
}
.dp-overlay.active { display: block; }
.dp-box {
  background: #fff; border-radius: 8px; width: 92vw; max-width: 360px; padding: 12px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.25); margin: 10vh auto 0;
}
.dp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-month { color: var(--brand); font-weight: 700; }
.dp-nav { border: none; background: transparent; font-size: 18px; color: #f2c84b; cursor: pointer; }
.dp-week, .dp-grid { font-size: 0; }
.dp-week span, .dp-grid .dp-empty, .dp-grid .dp-day { display: inline-block; width: 14.2857%; box-sizing: border-box; text-align: center; }
.dp-week { margin: 6px 0; color: #666; }
.dp-week span { color: var(--brand); opacity: .9; }
.dp-grid { margin-top: 4px; }
.dp-empty { height: 36px; }
.dp-day {
  height: 36px; border: 1px solid var(--brand); background: #fff; color: #333; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 34px;
}
.dp-day:hover { border-color: var(--brand); }
.dp-day:focus { outline: 2px solid var(--brand); outline-offset: 2px; }
.dp-actions { margin-top: 10px; text-align: right; }
.dp-actions .dp-close { border: none; background: var(--brand); color: #fff; padding: 6px 12px; border-radius: 6px; cursor: pointer; }

/* ================================
   Data Index（センター寄せ＆タブ）
   ================================ */

/* data-wrap を中央寄せ・幅制限 */
.data-wrap {
  box-sizing: border-box;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

/* タブ */
.tabs { display: flex; gap: 14px; margin: 0 0 14px; }
.tab-btn {
  padding: 7px 7px;
  border: none;
  border-radius: 5px;
  background: #fff;
  color: #333;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,.1);
}
.tab-btn[aria-selected="true"] { font-weight: 700; color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* 月ナビ（左：前月／中央：タイトル／右：次月） */
.month-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin: 0 0 14px;
}
.month-title { justify-self: center; text-align: center; }
.month-title .line1 { font-weight: 700; color: var(--brand); }
.month-title .line2 { color: #333; }

.nav-form { justify-self: start; }
.month-nav .nav-form:last-child { justify-self: end; }

.nav-btn,
.month-nav a {
  display: inline-block;
  padding: 7px 7px;
  border: none;
  border-radius: 5px;
  background: #fff;
  color: #333;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,.1);
}
.nav-btn:hover,
.month-nav a:hover { color: var(--brand); }

/* ================================
   <main> 配下：カード風に統一（カレンダー／グラフ／一覧）
   ================================ */
main > h1 {
  max-width: 960px;
  margin: 0 auto 12px;
  font-size: 18px;
  color: #333;
  font-weight: 700;
}
main > section { max-width: 960px; margin: 0 auto; }

/* 一覧テーブル（main直下） */
main > section > table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,.1);
  overflow: hidden;
}
main > section > table thead th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 700;
  color: #333;
  background: #f7fafc;
  border-bottom: 1px solid #e9eef5;
}
main > section > table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  text-align: right;
}
main > section > table tbody td:first-child,
main > section > table thead th:first-child { text-align: left; }
main > section > table tbody tr:last-child td { border-bottom: none; }
main > section > table tbody tr:hover { background: #fafcff; }

/* 既存 .data-table も寄せる */
table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,.1);
}
table.data-table thead th {
  background: #f7fafc;
  border-bottom: 1px solid #e9eef5;
  border-radius: 5px 5px 0 0;
  padding: 7px;
}
table.data-table td { padding: 7px; border-bottom: 1px solid #eef2f7; }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* カレンダー（カード風） */
.cal {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 5px 5px 0 0;
  box-shadow: 0 2px 5px rgba(0,0,0,.1);
  overflow: hidden;
  border-bottom: none;
}
.cal thead th {
  background: #f7fafc;
  color: #666;
  font-weight: 700;
  padding: 7px 0;
  border-bottom: 1px solid #e9eef5;
}
.cal td, .cal th { border: 1px solid #eef2f7; }
.cal td {
  vertical-align: top;
  width: 14.2857%;
  height: 64px;
  padding: 6px 8px;
  position: relative;
  background: #fff;
}
.cal a.daylink { display: block; height: 100%; color: inherit; }
.cal .daynum { font-weight: 700; color: #333; line-height: 1; }

/* 既存：単一値用（互換のため残す） */
.cal .amount {
  display: block;
  font-size: 12px;
  position: absolute;
  right: 6px;
  bottom: 4px;
  text-align: right;
}
.cal .amount.hit { color: var(--brand); }
.cal .amount.miss { color: #d94f4f; }
.cal .amount.neutral { color: #666; }

/* ▼ 新規：3段表示（税抜 / 回数 / 平均単価）※単位なし・右下詰め */
.cal .cell-stats {
  position: absolute;
  right: 6px;
  bottom: 4px;
  text-align: right;
  font-size: 12px;
  line-height: 1.1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal .cell-stats .cell-stat { display: block; }
.cal .cell-stats.hit .cell-stat { color: var(--brand); }
.cal .cell-stats.miss .cell-stat { color: #d94f4f; }
.cal .cell-stats.neutral .cell-stat { color: #666; }

/* ▼ サマリー：カレンダー直下に連結 */
.summary {
  background: #fff;
  margin-top: 0;
  padding: 7px;
  border-top: none;
  border-radius: 0 0 5px 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,.1);
  border: 1px solid #e9eef5;
}
.cal + .summary { margin-top: 0; }
.summary dl { display: grid; grid-template-columns: 1fr 1fr; row-gap: 6px; }
.summary dt { color: #666; }
.summary dd { text-align: right; font-weight: 700; }

/* グラフ（カード化） */
.chart-wrap {
  background:#fff;
  border: none;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,.1);
  overflow: hidden;
}
#graphSvg { width: 100%; height: 360px; display: block; }

.chart-legend {
  display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 14px; font-size: 12px; color: #333;
}
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; }
.chart-legend .dot { width: 10px; height: 10px; border-radius: 2px; background: #ccc; }

/* ================================
   期間/表示系列セレクトをタブ/月ナビ風に
   ================================ */
/* ネイティブselect（見せる版の共通見た目） */
.graph-controls select {
  -webkit-appearance: none; appearance: none;
  padding: 7px 28px 7px 10px;
  border: none;
  border-radius: 5px;
  background: #fff;
  color: #333;
  cursor: pointer;
  line-height: 1.4;
  font-size: 14px;
  box-shadow: 0 2px 5px rgba(0,0,0,.1);
}
.graph-controls select:hover { color: var(--brand); }

/* ▼ JSが生成するカスタムUIがあるときはネイティブを完全に隠す */
.graph-controls select#gPeriod.is-hidden {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  clip: rect(0,0,0,0) !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
}

/* カスタムトリガー（期間/表示系列） */
.ms-trigger,
.sl-trigger {
  display: inline-block;
  position: relative;
  padding: 7px 28px 7px 7px;
  border: none;
  border-radius: 5px;
  background: #fff;
  color: #333;
  cursor: pointer;
  line-height: 1.4;
  box-shadow: 0 2px 5px rgba(0,0,0,.1);
}
.ms-trigger:hover,
.sl-trigger:hover { color: var(--brand); }

/* ▼ 逆三角形（▼）マーク：トリガーにのみ表示 */
.ms-trigger::after,
.sl-trigger::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 5px 0 5px;
  border-style: solid;
  border-color: #666 transparent transparent transparent;
  pointer-events: none;
}
/* ラベル(#gPeriod)には出さない（右端の矢印防止） */
.graph-controls label:has(#gPeriod)::after { content: none !important; }

/* ドロップダウン本体 */
.multiselect { position: relative; display: inline-block; }
.ms-menu,
.sl-menu {
  display: none;
  position: absolute;
  left: 0; top: calc(100% + 4px);
  min-width: 180px;
  background: #fff;
  border: 1px solid #d9e3ef;
  border-radius: 6px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.15);
  padding: 8px;
  z-index: 3000;
}
.multiselect.open .ms-menu { display: block; }
.selectlike { position: relative; display: inline-block; }
.selectlike.open .sl-menu { display: block; }
.ms-menu label {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px;
  font-size: 14px; color: #333;
}
.ms-menu input[type="checkbox"] {
  -webkit-appearance: checkbox !important;
  appearance: checkbox !important;
  width: auto; height: auto; margin: 0;
}
.sl-menu .sl-item {
  display: block; width: 100%; text-align: left;
  padding: 6px 8px; border: none; background: transparent; color: #333;
  border-radius: 4px; cursor: pointer; font-size: 14px;
}
.sl-menu .sl-item:hover,
.sl-menu .sl-item[aria-selected="true"] { background: #f7fafc; }

/* ================================
   一覧の「編集」「削除」ボタン＝タブ/月ナビ風
   ================================ */
main > section > table td form { display: inline-block; }
main > section > table td form + form { margin-left: 8px; }

main > section > table td form button,
.row-actions button {
  padding: 7px 7px;
  border: none;
  border-radius: 5px;
  background: #fff;
  color: #333;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,.1);
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}
main > section > table td form button:hover,
.row-actions button:hover { color: var(--brand); }
main > section > table td form + form button { color: #d94f4f; }
main > section > table td form + form button:hover { color: #b23a3a; }
.row-actions .btn-edit { background: var(--brand); color: #fff; }
.row-actions .btn-edit:hover { color: #fff; }
.row-actions .btn-del  { background: #d94f4f; color: #fff; }
.row-actions .btn-del:hover { color: #fff; }

/* ================================
   グラフ：月ナビ（そのまま）
   ================================ */
.graph-panel .month-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}
.graph-panel .month-nav .nav-btn:first-child { justify-self: start; }
.graph-panel .month-nav .month-title { justify-self: center; text-align: center; }
.graph-panel .month-nav .nav-btn:last-child { justify-self: end; }

/* コントロール行 */
.graph-controls {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 0 0 14px;
}
.graph-controls .checks { display: inline-flex; gap: 14px; align-items: center; }
.graph-controls label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #333; }

/* ================================
   凡例の色（線色と一致）
   ================================ */
.chart-legend .dot.color-blue   { background:#4f8bc2; }
.chart-legend .dot.color-red    { background:#d94f4f; }
.chart-legend .dot.color-orange { background:#e58e26; }
.chart-legend .dot.color-yellow { background:#f2c84b; }
.chart-legend .dot.color-green  { background:#6bab7d; }
.chart-legend .dot.color-indigo { background:#2d4e72; }
.chart-legend .dot.color-purple { background:#8d70b9; }

/* ================================
   詳細ダイアログの暴発ガード
   ================================ */
.detail-dialog { display: none !important; position: fixed; inset: 0; z-index: 9998; }
.detail-dialog:target { display: block !important; }
.detail-dialog .detail-bg { position: absolute; inset: 0; background: rgba(0,0,0,0.6); display: block; }
.detail-dialog-box {
  position: relative;
  background: #fff; border-radius: 8px; padding: 20px 30px; text-align: left;
  max-width: 300px; width: 90%; box-shadow: 0 0 10px rgba(0,0,0,0.3);
  margin: 20vh auto 0; z-index: 1; max-height: 80vh;
}
.detail-dialog-box .hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.detail-dialog-box .hdr h2 { font-size: 18px; color: #333; }
.detail-dialog-box .close { border: 1px solid #d9e3ef; padding: 4px 8px; border-radius: 6px; background: #fff; color: #333; }
.detail-dialog-box .body { max-height: 50vh; overflow: auto; }
.detail-dialog-box .body table { width: 100%; border-collapse: collapse; }
.detail-dialog-box .body th, .detail-dialog-box .body td { padding: 6px; border-bottom: 1px solid #eee; }
.detail-dialog-box .body th { text-align: left; }
.detail-dialog-box .body td { text-align: right; word-break: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.detail-dialog-box .body .note-head th { border-bottom: none; padding-bottom: 2px; }
.detail-dialog-box .body .note-head td { border-bottom: none; }
.detail-dialog-box .body td.note-cell { text-align: left; padding-top: 0; border-top: none; border-bottom: none; }
.detail-dialog-box .actions { display: flex; gap: 8px; margin-top: 12px; }
.detail-dialog-box .actions form { flex: 1; }
.detail-dialog-box .actions button { width: 100%; padding: 8px 0; border: none; border-radius: 6px; cursor: pointer; }
.detail-dialog-box .actions .btn-edit { background: #4f8bc2; color: #fff; }
.detail-dialog-box .actions .btn-del  { background: #d94f4f; color: #fff; }
