/* ================================
   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 ul li:has(> a[title="トップへ戻る"]) { margin-right: auto; }
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; }

/* ▼ ID/PASSの下線を完全一致させる：.fieldで下線描画 */
.login-form .field { position: relative; }
.login-form .field::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--brand);
  pointer-events: none;
}
/* 入力自身のボーダーは消して二重線を防止（ログインフォーム内のみ） */
.login-form .field input { border-bottom-color: transparent; }

/* ▼ パスワード表示切替（目アイコン） */
.login-form .pw-wrap { position: relative; }
.login-form .pw-wrap input { padding-right: 40px; position: relative; z-index: 0; }
.login-form .pw-toggle {
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: none; background: transparent; cursor: pointer;
  color: var(--brand);
  z-index: 2;
}
.login-form .pw-toggle .material-symbols-sharp { font-size: 22px; line-height: 1; }
.login-form .pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ▼ 追加：autofill 背景がボタン領域に“はみ出す”のをマスクする */
.login-form .pw-wrap::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 2px;            /* 下線(2px)は残す */
  width: 40px;            /* input の padding-right と合わせる */
  background: var(--page-bg);
  pointer-events: none;
  z-index: 1;             /* input(0) の上、ボタン(2) の下 */
}

/* ▼ オートフィル色の統一（ログイン用） */
.login-form input:-webkit-autofill,
.login-form input:-webkit-autofill:hover,
.login-form input:-webkit-autofill:focus,
.login-form input:-webkit-autofill:active {
  -webkit-text-fill-color: #333 !important;
  background-color: var(--page-bg) !important;
  box-shadow: 0 0 0px 1000px var(--page-bg) inset !important;
  transition: background-color 99999s ease-out, color 99999s ease-out;
  caret-color: #333;
}

/* ▼ ログインを“ほんの少しだけ”上に */
.login.login--raised { transform: translateY(-24px); }
@media (max-height: 520px) {
  .login.login--raised { transform: translateY(-12px); }
}

/* ================================
   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; }

/* ================================
   期間/表示系列セレクトをタブ/月ナビ風に
   ================================ */
.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); }

.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;
}
.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 .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;
}

/* ================================
   Config（set/）専用：トグルスイッチ
   ================================ */
.section-title { margin: 18px 6px 8px; font-weight: 700; color: var(--brand); }
.switch-row { display:flex; align-items:center; justify-content:space-between; padding: 8px 6px; }
.toggle {
  display: inline-flex; align-items: center; gap: 10px; user-select: none;
  font-size: 14px; color: #333;
}
.toggle input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
  width: 48px; height: 28px; border-radius: 999px; background: #d9e3ef; position: relative;
  transition: background .18s ease; box-shadow: inset 0 0 0 1px #cfd9e6;
}
.toggle .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s ease;
}
.toggle input[type="checkbox"]:checked + .track { background: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.toggle input[type="checkbox"]:checked + .track::after { transform: translateX(20px); }
.toggle .label-text { font-weight: 700; color: var(--brand); }
.toggle .state-text { min-width: 34px; text-align: right; color: #666; font-variant-numeric: tabular-nums; }

/* ▼ 目標金額：入力と保存ボタンを横並び（set/限定の緩やかな指定） */
.input .target-inline{
  display:flex;
  align-items:flex-end;
  gap:10px;
  padding: 0 6px;
}
.input .target-inline .fl-group{
  flex:1 1 auto;
  padding:0; /* 既存の .fl-group の左右 6px をこの行では無効化 */
}
.input .target-inline .btn-save{
  flex:0 0 auto;
  height: 44px;
  padding: 0 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,.1);
}
.input .target-inline .btn-save:hover{ opacity:.9; }

/* ================================
   Train page（index.html <main>）
   ================================ */
:root{
  --train-red:   #d94f4f;
  --train-yellow:#f2c84b;
  --train-green: #6bab7d;
}
.train{
  background:#fff;
  border-radius:5px;
  box-shadow:0 2px 5px rgba(0,0,0,.1);
  overflow:hidden;
  max-width:960px;
  margin:0 auto 14px;
}
.train .group{
  display:block;
  padding:12px;
  border-bottom:1px solid #eef2f7;
}
.train .group:last-child{ border-bottom:none; }
.train .ops{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  min-width:0;
}
.train .signal .material-symbols-sharp{ font-size:28px; line-height:1; }
.train .route{
  font-weight:700;
  color:#333;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.toggle-route{
  margin-left:auto;
  display:inline-flex;
  align-items:center;
  border:none;
  background:transparent;
  padding:4px;
  cursor:pointer;
}
.toggle-route .material-symbols-sharp {
  color: var(--brand);
  font-size:22px;
}
.route-toggle{
  position:absolute;
  inline-size:1px;
  block-size:1px;
  margin:-1px;
  padding:0;
  border:0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow:hidden;
  white-space:nowrap;
}
.train .info{
  display:flex;
  align-items:center;
  gap:8px;
  color:#333;
  margin-top:6px;
}
.train .info .dt{ font-weight:700; }
.train .info .dd{ opacity:.9; }
.train .station{
  display:none;
  font-size:14px;
  color:#333;
  opacity:.9;
  margin-top:6px;
}
.group > .route-toggle:checked ~ .station{ display:block !important; }
.train .group.is-open .station{ display:block !important; }
.train.is-warning .signal .material-symbols-sharp{ color:var(--train-red); }
.train.is-warning .info .dt{ color:var(--train-red); }
.train.is-delay   .signal .material-symbols-sharp{ color:var(--train-yellow); }
.train.is-delay   .info .dt{ color:var(--train-yellow); }
.train.is-normal  .signal .material-symbols-sharp{ color:var(--train-green); }
.train.is-normal  .info .dt{ color:var(--train-green); }
.train.is-normal .group{
  padding:8px 12px;
  border-bottom:none;
}
.t-time{
  max-width:960px;
  margin:8px auto 0;
  color:#666;
  font-size:12px;
  padding:0 2px;
}

/* ===== event/input.html 専用（スコープ：.ev-input） ===== */
.ev-input .ev-venue-row { margin-bottom: 8px; }
.ev-input .ev-venue-select { display:flex; align-items:center; gap:8px; }
.ev-input .ev-venue-select .flabel { top: -12px !important; font-size: 12px !important; opacity: 1 !important; }
.ev-input .select .flabel { top: -12px !important; font-size: 12px !important; opacity: 1 !important; }
.ev-input .fl-group.select select,
.ev-input .ev-venue-select select {
  width: 100%;
  background: #fff;
  border: none;
  border-bottom: 2px solid var(--brand);
  padding: 8px 8px 8px 8px;
  font-size: 16px;
  color: #333;
}
.ev-input .input-grid { row-gap: 16px; }
.ev-input .fl-group { padding: 0 4px; }
.ev-input .fl-group input,
.ev-input .fl-group textarea { padding: 8px 0; }
.ev-input .fullwidth-field { grid-column: 1 / -1; }
.ev-input .is-hidden { display: none !重要; }
.ev-input .venue-link {
  display: inline-block;
  padding: 4px 8px;
  border: none;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.1);
  color: #333;
  font-size: 13px;
  line-height: 1.2;
  vertical-align: middle;
}
.ev-input .venue-link[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.ev-input .dropzone {
  border: 2px dashed #d9e3ef;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: #666;
  background: #fff;
  cursor: pointer;
}
.ev-input #timeRows { margin-top: 2px; }
.ev-input #timeRows .time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.ev-input #timeRows .time-row:first-child { margin-top: 0; }
.ev-input #timeRows .time-row input {
  display: inline-block;
  width: 110px;
  max-width: 110px;
  margin: 0;
}
.ev-input .time-title { margin-bottom: 4px; color: var(--brand); font-weight: 700; }
.ev-input .data-wrap { max-width: 1200px; margin: 0 auto; }
.ev-input .table-scroll { overflow-x: auto; }
.ev-input .table-scroll .data-table { min-width: 1200px; }
.ev-input table.data-table th,
.ev-input table.data-table td { text-align: left; vertical-align: top; }
.ev-input table.data-table td col-actions { white-space: nowrap; }
.ev-input table.data-table td small { color:#666; }
.ev-input .thumb-preview img { max-height: 48px; border-radius: 4px; }
.ev-input .ev-sep { margin: 12px 0; border: none; border-top: 1px solid #e9eef5; }

/* ====== ここまでが既存 ====== */


/* ===== event/index.html 専用（スコープ：.ev-index） ===== */
.ev-index{
  --ev-brand:#4f8bc2;
  --ev-text:#333;
  --ev-card-bg:#fff;
  --ev-border:#e9eef5;
  --ev-shadow:0 2px 8px rgba(0,0,0,.08);
  --ev-muted:#666;
  --ev-link:#2d4e72;
  --ev-radius:10px;
  --ev-pad:14px;
  --ev-thumb-w:20%;
  color:var(--ev-text);
}
.ev-index a{ color:var(--ev-link); text-decoration:none; }
.ev-index a:hover{ opacity:.9; }
.ev-index a img{ border:0; outline:0; }

.ev-index .material-symbols-sharp{
  font-variation-settings:'FILL' 0,'wght' 400,'GRAD' 0,'opsz' 24;
  font-size:14px; line-height:14px; vertical-align:text-bottom;
}

.ev-index .lh14{ line-height:14px !important; }

.ev-index .list{
  max-width:960px; margin:0 auto 18px; padding:0;
  display:grid; grid-template-columns:1fr; gap:14px;
}

.ev-index .ev-card{
  background:var(--ev-card-bg);
  border:1px solid var(--ev-border);
  border-radius:var(--ev-radius);
  box-shadow:var(--ev-shadow);
  overflow:hidden;
}

.ev-index .title-card .title-row{ padding: var(--ev-pad); }
.ev-index .title-card h1{
  margin:0; padding:0;
  font-size:18px; font-weight:700; color:var(--ev-brand);
  text-align:left; line-height:14px;
}

.ev-index .ev-stopped{
  max-width:960px; margin:0 auto; padding:14px;
  color:#b23a3a; font-weight:700;
}

.ev-index .ev-head{
  display:flex; align-items:center; gap:0;
  padding: var(--ev-pad) var(--ev-pad) 0 var(--ev-pad);
  background:#fff;
}
.ev-index .venue-name{
  margin:0; font-weight:700; color:var(--ev-brand);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  text-align:left; line-height:14px;
}
.ev-index .venue-cal{
  display:inline-flex; align-items:center; justify-content:center;
  width:14px; height:14px; margin-left:14px;
}

.ev-index .ev-body{
  position:relative;
  display:flex; flex-direction:column; gap:14px;
  padding: var(--ev-pad) 0 var(--ev-pad) 0;
}

.ev-index .ev-card.has-thumb .ev-body{
  padding-right: calc(var(--ev-thumb-w) + var(--ev-pad));
}

.ev-index .row{
  padding: 0 var(--ev-pad);
  text-align:left;
  line-height:14px;
}
.ev-index .row *{ text-align:left; line-height:14px; }

.ev-index .title-line{
  line-height:14px; word-break:break-word; white-space:normal;
}
.ev-index .genre-ico{
  display:inline-flex; align-items:center; justify-content:center;
  width:14px; height:14px; margin-right:0; color: var(--ev-brand);
}
.ev-index .ev-title{ display:inline; font-weight:700; color:var(--ev-text); }
.ev-index .event-link-icon{
  display:inline-flex; align-items:center; justify-content:center;
  width:14px; height:14px; margin-left:14px; vertical-align:text-bottom;
}

.ev-index .ev-caption{
  margin:0; font-size:13px; color:var(--ev-muted); white-space:pre-wrap; word-break:break-word;
}

.ev-index .time-set{ display:block; margin:0; padding:0; }
.ev-index .titem{
  display:inline-flex; align-items:baseline; gap:6px; color:var(--ev-text); font-size:14px;
}
.ev-index .time-set .titem + .titem{ margin-left:12px; }

.ev-index .thumb-abs{
  position:absolute;
  top:var(--ev-pad); bottom:var(--ev-pad); right:var(--ev-pad);
  width:var(--ev-thumb-w);
  display:flex; align-items:center; justify-content:center;
  pointer-events:auto;
}
.ev-index .ev-thumb{
  display:block; width:100%; height:100%;
  border:none; background:transparent; box-shadow:none;
  border-radius:8px; overflow:hidden;
}
.ev-index .ev-thumb img{
  display:block; width:100%; height:100%;
  object-fit:contain; border:0; outline:0; background:transparent;
}

.ev-index .imgdlg-overlay{
  display:none; position:fixed; inset:0; z-index:9999; background: rgba(0,0,0,.6);
}
.ev-index .imgdlg-overlay:target{ display:flex; align-items:center; justify-content:center; }
.ev-index .imgdlg-bg{ position:absolute; inset:0; display:block; }
.ev-index .imgdlg-inner{ position:relative; max-width:96vw; max-height:92vh; display:block; }
.ev-index .imgdlg-img{
  display:block; max-width:96vw; max-height:92vh; width:auto; height:auto; object-fit:contain; border-radius:8px;
  border:0; outline:0; background:transparent;
}
.ev-index .imgdlg-close{
  position:absolute; top:8px; right:8px; display:inline-flex; align-items:center; justify-content:center;
  width:28px; height:28px; border-radius:8px; background:#fff;
}

/* ===== spot/index.html 専用（後で style.css に統合） ===== */
.spot-app{
  --spot-card-h:44px;
  max-width:960px;
  margin:0 auto;
}

/* ヘッダ：セレクトとボタンを横並び・等高（間隔は厳密14px） */
.spot-app .spot-head{
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  column-gap:0;
  row-gap:0;
  margin:0 0 14px !important;
}
.spot-app .spot-select-form{
  padding:0 !important;
  margin:0 !important;
  width:100%;
  flex:1 1 auto;
  min-width:0;
}
.spot-app .spot-select-form select{
  -webkit-appearance:none;appearance:none;
  width:100%;height:var(--spot-card-h);
  padding:0 36px 0 12px;border:none;border-radius:6px;
  background:#fff;color:#333;box-shadow:0 2px 5px rgba(0,0,0,.1);
  line-height:var(--spot-card-h);cursor:pointer;
  font-size:16px;
}
.spot-app .spot-select-form select:focus{outline:2px solid #4f8bc2;outline-offset:2px;}
.spot-app .spot-input-toggle{
  display:inline-flex;align-items:center;gap:6px;
  height:var(--spot-card-h);padding:0 12px;border:none;border-radius:6px;
  background:#fff;color:#333;box-shadow:0 2px 5px rgba(0,0,0,.1);cursor:pointer;
  flex:0 0 auto;
  margin-left:14px !important;
}
.spot-app .spot-input-toggle .material-symbols-sharp{color:#4f8bc2;}
.spot-app .spot-input-toggle .txt{line-height:1;}

.spot-app .spot-toggle{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  margin:-1px !important;
  padding:0 !important;
  border:0 !important;
  overflow:hidden !重要;
  clip:rect(0 0 0 0) !important;
  clip-path:inset(50%) !important;
  white-space:nowrap !important;
}

.spot-app .spot-form{
  display:none;
  background:#fff;border-radius:6px;box-shadow:0 2px 5px rgba(0,0,0,.1);
  padding:12px;
  margin-top:0 !important;
  margin-bottom:14px;
}
.spot-app .spot-form.is-open{display:block;}
.spot-app .spot-form .row{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:10px;}
.spot-app .spot-form .row.full{grid-template-columns:1fr;}
.spot-app #newPlaceRow.row.full{grid-template-columns:1fr 1fr;}
.spot-app #existingBlock{display:grid;grid-template-columns:1fr;gap:10px;}
.spot-app .spot-form select{ font-size:16px; }
.spot-app .spot-form input,
.spot-app .spot-form textarea{ font-size:16px; }
.spot-app .spot-form label{display:block;font-size:13px;color:#4f8bc2;margin:4px 0;}
.spot-app .spot-form input[type="text"],
.spot-app .spot-form input[type="number"],
.spot-app .spot-form input[type="date"],
.spot-app .spot-form select,
.spot-app .spot-form textarea{
  width:100%;box-sizing:border-box;background:transparent;color:#333;
  border:none;border-bottom:2px solid #4f8bc2;padding:8px 0;
}
.spot-app .spot-form textarea{min-height:40px;resize:vertical;}
.spot-app .spot-form .actions{margin-top:12px;}
.spot-app .spot-form .actions button{
  width:100%;padding:10px 0;border:none;border-radius:6px;background:#4f8bc2;color:#fff;cursor:pointer;
}

.spot-app .spot-visually-hidden{
  position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;
  clip:rect(0 0 0 0);clip-path:inset(50%);overflow:hidden;white-space:nowrap;
}
.spot-app .mode-btn{
  display:inline-flex;align-items:center;justify-content:center;
  padding:8px 12px;border-radius:6px;background:#4f8bc2;
  color:#fff !important;
  box-shadow:0 2px 5px rgba(0,0,0,.1);
  width:auto;max-width:max-content;cursor:pointer;
  font-weight:400;
}
.spot-app .mode-btn.is-on{background:#4f8bc2;}
.spot-app #newPlaceRow{display:none;}
.spot-app #newPlaceRow.is-open{display:grid;}
.spot-app .is-hidden{display:none !important;}

.spot-app .spot-summary{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0 0 14px;
}
.spot-app .spot-card{
  position:relative;background:#fff;border-radius:6px;box-shadow:0 2px 5px rgba(0,0,0,.1);
  height:var(--spot-card-h);padding:0 12px;overflow:hidden;
}
.spot-app .spot-card .label{position:absolute;top:4px;left:12px;color:#4f8bc2;font-size:13px;font-weight:700;line-height:1;}
.spot-app .spot-card .value{position:absolute;right:12px;bottom:4px;color:#4f8bc2;font-weight:700;line-height:1;text-align:right;font-variant-numeric:tabular-nums;}

.spot-app .spot-break{
  background:#fff;border-radius:6px;box-shadow:0 2px 5px rgba(0,0,0,.1);overflow:hidden;margin:0 0 14px;
}
.spot-app .spot-break h3{margin:0;padding:10px 12px;background:#f7fafc;border-bottom:1px solid #e9eef5;color:#4f8bc2;font-size:14px;}
.spot-app .spot-break table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;background:transparent;}
.spot-app .spot-break table tbody tr:hover{background:#fafcff;}
.spot-app .spot-break table th,
.spot-app .spot-break table td{padding:10px 12px;border-bottom:1px solid #eef2f7;}
.spot-app .spot-break table tbody tr:last-child td{border-bottom:none;}
.spot-app .spot-break table :is(thead th,tbody td):nth-child(1){text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.spot-app .spot-break table :is(thead th,tbody td):nth-child(2){width:88px;text-align:center;}
.spot-app .spot-break table :is(thead th,tbody td):nth-child(3),
.spot-app .spot-break table :is(thead th,tbody td):nth-child(4){width:120px;text-align:center;}
.spot-app .spot-break table .empty td{text-align:left;color:#666;}
.spot-app .spot-break table thead{ display:none; }

.spot-app .spot-table-scroll{width:100%;}
.spot-app .spot-table-wrap{background:#fff;border-radius:6px;box-shadow:0 2px 5px rgba(0,0,0,.1);overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;}
.spot-app .spot-table{width:100%;border-collapse:collapse;min-width:1000px;}
.spot-app .spot-table thead th{padding:10px 12px;text-align:left;background:#f7fafc;border-bottom:1px solid #e9eef5;color:#4f8bc2;}
.spot-app .spot-table tbody td{padding:10px 12px;border-bottom:1px solid #eef2f7;white-space:nowrap;color:#666;}
.spot-app .spot-table tbody tr:last-child td{border-bottom:none;}
.spot-app .spot-table td.num{text-align:right;font-variant-numeric:tabular-nums;}
.spot-app .spot-table td.center{text-align:center;}

.spot-app .spot-msg{color:#2d4e72;}
.spot-app .spot-err{color:#b23a3a;}

@media (max-width:640px){
  .spot-app .spot-break table th,
  .spot-app .spot-break table td,
  .spot-app .spot-table thead th,
  .spot-app .spot-table tbody td {
    padding:8px 8px;
    font-size:13px;
  }
  .spot-app .spot-break h3{ font-size:13px; padding:8px 10px; }
  .spot-app .spot-break table :is(thead th,tbody td):nth-child(2){width:72px;}
  .spot-app .spot-break table :is(thead th,tbody td):nth-child(3),
  .spot-app .spot-break table :is(thead th,tbody td):nth-child(4){width:104px;}
}
@media (max-width:400px){
  .spot-app .spot-break table th,
  .spot-app .spot-break table td{
    padding:6px 6px;
    font-size:12.5px;
  }
  .spot-app .spot-break h3{ font-size:12.5px; padding:8px 10px; }
  .spot-app .spot-break table :is(thead th,tbody td):nth-child(2){width:64px;}
  .spot-app .spot-break table :is(thead th,tbody td):nth-child(3),
  .spot-app .spot-break table :is(thead th,tbody td):nth-child(4){width:96px;}
}

@supports (-webkit-touch-callout: none){
  .spot-app .spot-select-form select,
  .spot-app .spot-form select,
  .spot-app .spot-form input,
  .spot-app .spot-form textarea{
    font-size:16px;
  }
}

/* オートフィル背景の統一（spotフォームのみ） */
.spot-app .spot-form input:-webkit-autofill,
.spot-app .spot-form input:-webkit-autofill:hover,
.spot-app .spot-form input:-webkit-autofill:focus,
.spot-app .spot-form textarea:-webkit-autofill,
.spot-app .spot-form textarea:-webkit-autofill:hover,
.spot-app .spot-form textarea:-webkit-autofill:focus,
.spot-app .spot-form select:-webkit-autofill,
.spot-app .spot-form select:-webkit-autofill:hover,
.spot-app .spot-form select:-webkit-autofill:focus{
  -webkit-text-fill-color:#333 !important;
  -webkit-box-shadow:0 0 0px 1000px #fff inset !important;
  box-shadow:0 0 0px 1000px #fff inset !important;
  transition:background-color 0s !important;
}
