/* ===== 全体レイアウト ===== */
* {
  box-sizing: border-box;
}

body {
  font-family: "Helvetica Neue", Arial, "Hiragino Sans", "Meiryo", sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f5f6f8;
  color: #333;
}

/* コンテナ: 最大幅を設定し中央寄せ（nfr-20260831-8dcfb090） */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 20px;
}

/* ===== ログイン画面 ===== */
/* 画面全体の中央に配置する（コンテナの左寄せに影響されないよう画面基準で中央寄せ） */
.login-view {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
  width: 100%;
}

.login-form {
  background: #fff;
  padding: 32px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 360px;
}

.login-form h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

.form-row {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.form-row label {
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.form-row input {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.login-form button {
  width: 100%;
  padding: 10px;
  background-color: #4e79a7;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

.login-form button:disabled {
  background-color: #9db3cc;
  cursor: not-allowed;
}

.login-error {
  color: #e15759;
  font-size: 0.9rem;
  margin-top: 12px;
  min-height: 1.2em;
}

/* ===== コントロール群: 折り返し対応（nfr-20260831-8dcfb090） ===== */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.control-item {
  display: flex;
  flex-direction: column;
}

.control-item label {
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.control-item input,
.control-item select {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
}

.control-item button {
  padding: 9px 20px;
  background-color: #59a14f;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  cursor: pointer;
}

.control-item button:disabled {
  background-color: #a8c9a4;
  cursor: not-allowed;
}

/* コントロール群の下の注意書き */
.controls-note {
  margin: -8px 0 20px;
  font-size: 0.85rem;
  color: #666;
}

/* ===== グラフ領域: コンテナ幅に追従（Chart.js responsive） ===== */
.chart-container,
.plan-usage-container,
.plan-comparison-container {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  position: relative;
}

/* セクション見出し */
.section-title {
  font-size: 1.1rem;
  margin: 0 0 12px;
}

/* セクションの補足文 */
.section-note {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 12px;
}

/* ①グラフのプラン色凡例 */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* 超過を示す赤枠の見本 */
.chart-legend-swatch.chart-legend-over {
  background-color: transparent;
  border: 3px solid #e15759;
  width: 12px;
  height: 12px;
}

/* 為替レート入力コントロール */
.currency-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.currency-control input {
  width: 140px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* プラン列見出し（名前と諸元を2段表示） */
.plan-col-name {
  font-weight: bold;
}

.plan-col-spec {
  font-size: 0.78rem;
  color: #666;
  font-weight: normal;
}

/* グラフの高さ確保（maintainAspectRatio:false と組み合わせる）。
   ①はユーザー数に応じて縦に伸びるため少し高めに確保する。 */
.daily-chart {
  height: 400px;
  position: relative;
}

.plan-usage-chart {
  height: 420px;
  position: relative;
}

/* ===== プラン比較表のセル色分け ===== */
/* 現在プランのセル（薄青） */
.current-plan-cell {
  background-color: #dceafc;
  font-weight: bold;
}

/* 最安プランのセル（薄緑） */
.cheapest-cell {
  background-color: #d9f2d9;
  font-weight: bold;
}

/* 現在=最安が一致する場合は緑地に枠線で強調 */
.current-plan-cell.cheapest-cell {
  background-color: #cdeccd;
  box-shadow: inset 0 0 0 2px #59a14f;
}

/* 凡例スウォッチ（補足文中の色見本） */
.legend-swatch {
  display: inline-block;
  padding: 2px 8px;
  margin-left: 8px;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: bold;
}

#planTable {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

#planTable th,
#planTable td {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  text-align: left;
  font-size: 0.9rem;
}

#planTable thead th {
  background-color: #f0f2f5;
  position: sticky;
  top: 0;
}

/* ===== テーブル領域: 横スクロール対応（nfr-20260831-8dcfb090） ===== */
.table-container {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 20px;
}

#dataTable {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

#dataTable th,
#dataTable td {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  text-align: left;
  font-size: 0.9rem;
}

#dataTable thead th {
  background-color: #f0f2f5;
  position: sticky;
  top: 0;
}

.table-message {
  text-align: center;
  color: #888;
  padding: 24px;
}
