/* EV導入効果試算ツール - スタイル */
:root {
  --color-main: #003087;
  --color-accent: #00a651;
  --color-bg: #f4f6fa;
  --color-card: #ffffff;
  --color-text: #1a1a2e;
  --color-border: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

.header {
  background: var(--color-main);
  color: #fff;
  padding: 1rem 1.5rem;
}

.header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 0;
  background: var(--color-card);
  border-bottom: 2px solid var(--color-border);
  padding: 0 1rem;
  max-width: 1280px;
  margin: 0 auto;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.9rem;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.tab-btn:hover {
  color: var(--color-main);
}

.tab-btn.active {
  color: var(--color-main);
  font-weight: 600;
  border-bottom-color: var(--color-accent);
}

.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* 基本情報入力 - 2カラム */
.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 900px) {
  .two-column {
    grid-template-columns: 1fr;
  }
}

.column-form h2,
.column-summary h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-main);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.column-form h2:not(:first-child) {
  margin-top: 1.5rem;
}

/* サブタブ（基本情報入力 左カラム内） */
.sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.sub-tab-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: #e2e8f0;
  color: #64748b;
  transition: background 0.15s, color 0.15s;
}

.sub-tab-btn:hover {
  background: #cbd5e1;
  color: var(--color-text);
}

.sub-tab-btn.active {
  background: var(--color-main);
  color: #fff;
}

.sub-tab-panel {
  display: none;
}

.sub-tab-panel.active {
  display: block;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--color-text);
}

.form-group input,
.form-group select {
  width: 100%;
  max-width: 320px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-main);
  box-shadow: 0 0 0 2px rgba(0, 48, 135, 0.15);
}

.form-group input[type="range"] {
  max-width: 280px;
  padding: 0;
}

.form-note {
  margin: 0.35rem 0 0;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border-left: 3px solid var(--color-main);
  font-size: 0.78rem;
  line-height: 1.5;
  color: #475569;
  max-width: 320px;
}

/* タスク4: 投資回収に影響する重要入力欄の強調 */
.form-group.important-input {
  background: #fff9db;
  border-left: 4px solid #f59e0b;
  padding: 0.6rem 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}
.form-group.important-input label {
  color: #b45309;
  font-weight: 600;
}
.form-group.important-input input {
  background: #fff;
  border-color: #f59e0b;
}

/* タスク1: 車両台数バッジ */
.result-unit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, #003087 0%, #1e40af 100%);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  margin: 0 0 1rem 0;
  box-shadow: 0 2px 6px rgba(0, 48, 135, 0.25);
}
.result-unit-badge .badge-icon {
  color: #fbbf24;
  font-size: 1.1rem;
}
#result-unit-count {
  font-size: 1.4rem;
  color: #fbbf24;
  margin: 0 0.15rem;
}

/* ダッシュボード右半分：4枚サマリーカードのグリッド配置 */
.dashboard-summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-content: start;
}

/* タスク5: 新出光側サブタブの損益分岐単価表示 */
.shinidemi-summary {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  background: #f0f4fa;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin: 1rem 0;
  border-left: 4px solid var(--color-main);
}
.shinidemi-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-main);
}
.shinidemi-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #003087;
}
.shinidemi-unit {
  font-size: 0.85rem;
  color: #475569;
}

/* サマリーカード */
.column-summary {
  position: sticky;
  top: 1rem;
  align-self: start;
}

.summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.summary-card {
  background: var(--color-card);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--color-border);
}

.summary-label {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.summary-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-accent);
}

.summary-unit {
  font-size: 0.75rem;
  color: #64748b;
  margin-left: 0.25rem;
}

/* 試算結果タブ */
.cost-table-wrap,
.chart-box,
.co2-panel {
  background: var(--color-card);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--color-border);
}

.cost-table-wrap h2,
.chart-box h3,
.co2-panel h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-main);
}

.cost-table {
  width: 100%;
  border-collapse: collapse;
}

.cost-table th,
.cost-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.cost-table th {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text);
}

.cost-table .total-row {
  font-weight: 700;
  background: rgba(0, 166, 81, 0.06);
}

.cost-table .total-row td {
  border-bottom: none;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.chart-box.full {
  grid-column: 1 / -1;
}

.chart-box canvas {
  max-height: 280px;
}

.co2-panel p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
}

.export-wrap {
  margin-top: 1.5rem;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover {
  background: #008f45;
}

/* 確認事項タブ */
.confirm-section-title {
  margin: 0 0 0.75rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

#tab-confirm .confirm-section-title:first-child {
  margin-top: 0;
}

#tab-confirm .confirm-section-title:not(:first-child) {
  margin-top: 2rem;
}

.confirm-subsection-title {
  margin: 1.25rem 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-main);
}

.confirm-subsection-title:first-child {
  margin-top: 0;
}

.confirm-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.confirm-table th,
.confirm-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.confirm-table th {
  background: var(--color-main);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
}

.confirm-table tbody tr:last-child td {
  border-bottom: none;
}

.confirm-table .status-btn {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  font-size: 0.8rem;
  cursor: pointer;
}

.confirm-table .status-btn:hover {
  background: var(--color-bg);
}

.confirm-table .status-btn.confirmed {
  background: rgba(0, 166, 81, 0.15);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.confirm-table .status-btn.checking {
  background: rgba(0, 48, 135, 0.1);
  border-color: var(--color-main);
  color: var(--color-main);
}

/* アコーディオン（確認事項） */
.confirm-accordion {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.confirm-accordion-summary {
  display: flex;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: var(--color-card);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-main);
  list-style: none;
  user-select: none;
}

.confirm-accordion-summary::-webkit-details-marker {
  display: none;
}

.confirm-accordion-summary::before {
  content: '\25B6';
  font-size: 0.7rem;
  margin-right: 0.6rem;
  transition: transform 0.2s;
  color: #64748b;
}

.confirm-accordion[open] > .confirm-accordion-summary::before {
  transform: rotate(90deg);
}

.confirm-accordion-summary:hover {
  background: var(--color-bg);
}

.confirm-accordion-body {
  padding: 1.25rem;
  border-top: 1px solid var(--color-border);
}

.confirm-accordion-body .confirm-section-title:first-child {
  margin-top: 0;
}

/* セクション①：実装済み機能カード */
.progress-card {
  background: #f0faf4;
  border: 1px solid #c6f6d5;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.5rem;
}

.progress-card .confirm-section-title {
  margin-top: 0;
  margin-bottom: 1rem;
}

.progress-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.progress-list li {
  position: relative;
  padding: 0.5rem 0 0.5rem 2rem;
  font-size: 0.925rem;
  line-height: 1.5;
  color: var(--color-text);
}

.progress-list li::before {
  content: '\2705';
  position: absolute;
  left: 0;
  top: 0.45rem;
  font-size: 1.1rem;
}

.progress-list li + li {
  border-top: 1px solid #d4edda;
}

/* セクション間区切り線 */
.section-divider {
  border: none;
  border-top: 2px solid var(--color-border);
  margin: 2rem 0;
}

/* セクション③：運用費用 */
.cost-info-section {
  margin-top: 0.5rem;
}

.cost-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 700px) {
  .cost-cards {
    grid-template-columns: 1fr;
  }
}

.cost-info-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.cost-info-card h4 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-main);
}

.cost-info-table {
  width: 100%;
  border-collapse: collapse;
}

.cost-info-table td {
  padding: 0.5rem 0.5rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--color-border);
}

.cost-info-table tr:last-child td {
  border-bottom: none;
}

.cost-info-table .cost-value {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

.cost-info-table .subtotal-row td {
  font-weight: 700;
  border-top: 2px solid var(--color-border);
  padding-top: 0.6rem;
}

/* 合計カード */
.cost-total-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-card);
  border: 2px solid var(--color-main);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
}

.cost-total-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.cost-total-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-main);
}

/* オプションカード */
.cost-option-card {
  margin-bottom: 1rem;
}

.cost-option-list {
  margin: 0;
  padding: 0 0 0 1.25rem;
}

.cost-option-list li {
  font-size: 0.9rem;
  padding: 0.2rem 0;
  color: var(--color-text);
}

/* 注記 */
.cost-notes {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 0.75rem 1rem;
}

.cost-notes p {
  margin: 0.2rem 0;
  font-size: 0.85rem;
  color: #92400e;
}

/* 顧客管理タブ */
.client-register-wrap,
.client-list-wrap {
  background: var(--color-card);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--color-border);
}

.client-register-wrap h2,
.client-list-wrap h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-main);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.client-register-note {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0 0 1rem;
}

.client-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 700px) {
  .client-form-grid {
    grid-template-columns: 1fr;
  }
}

.client-form-grid .form-group input {
  max-width: 100%;
}

.required {
  color: #e53e3e;
  font-weight: 600;
}

.client-register-result {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.client-register-result.success {
  background: rgba(0, 166, 81, 0.1);
  border: 1px solid var(--color-accent);
  color: #065f46;
}

.client-register-result.error {
  background: rgba(229, 62, 62, 0.1);
  border: 1px solid #e53e3e;
  color: #9b2c2c;
}

.client-url-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  background: var(--color-bg);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  word-break: break-all;
}

.client-url-box .btn-copy {
  flex-shrink: 0;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-card);
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
}

.client-url-box .btn-copy:hover {
  background: var(--color-bg);
}

.client-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.client-table th,
.client-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.client-table th {
  background: var(--color-main);
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}

.client-table tbody tr:hover {
  background: rgba(0, 48, 135, 0.03);
}

.client-table .btn-action {
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-card);
  cursor: pointer;
  font-size: 0.75rem;
  margin-right: 0.25rem;
}

.client-table .btn-action:hover {
  background: var(--color-bg);
}

.client-table .btn-action.delete {
  color: #e53e3e;
  border-color: #e53e3e;
}

.client-table .btn-action.delete:hover {
  background: rgba(229, 62, 62, 0.08);
}

.client-empty {
  text-align: center;
  color: #64748b;
  padding: 2rem;
  font-size: 0.9rem;
}

/* ローディングスピナー */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  color: #64748b;
  font-size: 0.9rem;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-main);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* エラーメッセージ */
.error-message {
  padding: 1rem;
  background: rgba(229, 62, 62, 0.1);
  border: 1px solid #e53e3e;
  border-radius: 6px;
  color: #9b2c2c;
  font-size: 0.9rem;
  margin: 1rem 0;
}

/* 編集モーダル */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--color-card);
  border-radius: 8px;
  padding: 1.5rem;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-content h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: var(--color-main);
}

.modal-content .form-group {
  margin-bottom: 0.75rem;
}

.modal-content .form-group input {
  max-width: 100%;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.btn-secondary {
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-card);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
}

.btn-secondary:hover {
  background: var(--color-bg);
}

/* ===== 顧客専用ページ（client.html） ===== */
.client-header {
  background: var(--color-main);
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.client-header h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.client-header .company-name {
  font-size: 1rem;
  opacity: 0.9;
}

.client-page-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* 台数選択ボタン */
.units-select-wrap {
  text-align: center;
  margin-bottom: 2rem;
}

.units-select-wrap h2 {
  font-size: 1rem;
  color: var(--color-text);
  margin: 0 0 1rem;
  font-weight: 500;
}

.units-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.units-btn {
  width: 80px;
  height: 56px;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-card);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text);
  transition: all 0.15s;
}

.units-btn:hover {
  border-color: var(--color-main);
  background: rgba(0, 48, 135, 0.05);
}

.units-btn.active {
  border-color: var(--color-main);
  background: var(--color-main);
  color: #fff;
}

@media (max-width: 600px) {
  .units-btn {
    width: 64px;
    height: 48px;
    font-size: 1rem;
  }
}

/* 顧客ページ サマリーカード */
.client-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 700px) {
  .client-summary-cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 400px) {
  .client-summary-cards {
    grid-template-columns: 1fr;
  }
}

/* 顧客ページ ローディング全体 */
.client-page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
  color: #64748b;
}

.client-page-loading .spinner {
  width: 40px;
  height: 40px;
}

.client-page-error {
  text-align: center;
  padding: 4rem 1rem;
  color: #9b2c2c;
  font-size: 1.1rem;
}

@media (max-width: 900px) {
  .chart-row {
    grid-template-columns: 1fr;
  }
}
