/* 燃費・ガソリン代計算 /nenpi-calc/ 専用スタイル。
   .np- プレフィックスで共通CSSとの名前衝突を避ける。
   給油所や出発前にスマホで使う想定なので、入力欄とボタンは大きめ。 */

.np-area {
  --np-accent: #0284c7;
  --np-strong: #0f766e;
  max-width: 720px;
  margin: 22px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.np-lead {
  max-width: 720px;
  margin: 0 auto 2px;
  padding: 0 16px;
  font-size: 15px;
  line-height: 1.7;
  color: #334155;
}

.np-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

/* ---- タブ ---- */
.np-tabs {
  display: flex;
  gap: 6px;
}

.np-tab {
  flex: 1;
  font-size: 13.5px;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 6px;
  min-height: 50px;
  cursor: pointer;
  line-height: 1.35;
}

.np-tab:hover {
  background: #e2e8f0;
}

.np-tab-on,
.np-tab-on:hover {
  background: var(--np-accent);
  border-color: var(--np-accent);
  color: #fff;
}

.np-tab-num {
  display: block;
  font-size: 11px;
  opacity: 0.85;
  font-weight: 800;
}

/* ---- 入力 ---- */
.np-panel[hidden] {
  display: none;
}

.np-field {
  min-width: 0;
  margin-bottom: 14px;
}

.np-field:last-of-type {
  margin-bottom: 0;
}

.np-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.np-field-grid .np-field {
  margin-bottom: 0;
}

.np-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
}

.np-input {
  width: 100%;
  font-size: 20px;
  font-weight: 700;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  box-sizing: border-box;
  color: #1e293b;
  min-height: 52px;
  font-variant-numeric: tabular-nums;
}

.np-input-sm {
  font-size: 16px;
  font-weight: 600;
  min-height: 46px;
}

.np-input::placeholder {
  color: #cbd5e1;
  font-weight: 500;
  font-size: 14px;
}

.np-input:focus {
  outline: 2px solid var(--np-accent);
  outline-offset: 1px;
  border-color: var(--np-accent);
}

.np-unit-hint {
  margin: 5px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

/* ピル（入力方式の切替） */
.np-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.np-pill {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.np-pill input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.np-pill span {
  display: inline-flex;
  align-items: center;
  font-size: 13.5px;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 9px 15px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.np-pill input:checked + span {
  background: var(--np-accent);
  border-color: var(--np-accent);
  color: #fff;
  font-weight: 700;
}

.np-pill input:focus-visible + span {
  outline: 2px solid var(--np-accent);
  outline-offset: 2px;
}

/* トグル（往復） */
.np-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  margin-bottom: 14px;
}

.np-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.np-toggle-track {
  flex: 0 0 auto;
  position: relative;
  width: 44px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background-color 0.15s;
}

.np-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}

.np-toggle input:checked + .np-toggle-track {
  background: var(--np-accent);
}

.np-toggle input:checked + .np-toggle-track .np-toggle-thumb {
  transform: translateX(20px);
}

.np-toggle input:focus-visible + .np-toggle-track {
  outline: 2px solid var(--np-accent);
  outline-offset: 2px;
}

.np-toggle-text {
  font-size: 14px;
  color: #334155;
  font-weight: 600;
}

.np-odo-out {
  margin: 10px 0 0;
  font-size: 13.5px;
  font-weight: 700;
  color: #0f766e;
  font-variant-numeric: tabular-nums;
}

.np-odo-warn {
  color: #b45309;
}

/* ---- 結果 ---- */
.np-result {
  margin-top: 4px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.np-result-label {
  display: block;
  font-size: 12.5px;
  color: #64748b;
  margin-bottom: 2px;
}

.np-result-value {
  display: block;
  font-size: 38px;
  font-weight: 800;
  color: var(--np-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.np-result-sub {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.np-msg {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: #b45309;
}

.np-note {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: #64748b;
}

.np-btn {
  width: 100%;
  font-size: 14.5px;
  font-weight: 700;
  padding: 13px 14px;
  min-height: 50px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--np-accent);
  background: var(--np-accent);
  color: #fff;
  margin-top: 12px;
}

.np-btn:hover:not(:disabled) {
  background: #0369a1;
}

.np-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.np-btn-sub {
  background: #fff;
  color: var(--np-accent);
}

.np-btn-sub:hover:not(:disabled) {
  background: #f0f9ff;
}

.np-inline-btn {
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--np-accent);
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
}

.np-inline-btn[hidden] {
  display: none;
}

/* ---- 記録 ---- */
.np-sub-title {
  font-size: 14px;
  font-weight: 800;
  color: #475569;
  margin: 0 0 12px;
}

.np-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.np-stats:empty {
  display: none;
}

.np-stat {
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 10px 12px;
  background: #fff;
}

.np-stat-big {
  grid-column: 1 / -1;
  background: #f0fdfa;
  border-color: #99f6e4;
  text-align: center;
}

.np-stat-label {
  display: block;
  font-size: 11.5px;
  color: #94a3b8;
  margin-bottom: 2px;
}

.np-stat-value {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.np-stat-big .np-stat-value {
  font-size: 32px;
  color: var(--np-strong);
}

.np-chart {
  margin-top: 14px;
}

.np-chart[hidden] {
  display: none;
}

.np-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* common.css の `* { font-size: 14px }` が SVG の font-size 属性を上書きしてしまうため、
   グラフの文字サイズはクラス指定（＝より高い詳細度）で当てる。 */
.np-chart-svg text {
  font-size: 7.5px;
}

.np-chart-svg .np-chart-avg {
  font-size: 8px;
}

.np-list {
  margin-top: 14px;
  overflow-x: auto;
}

.np-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  min-width: 420px;
}

.np-table th,
.np-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 9px 8px;
  text-align: right;
  color: #334155;
  white-space: nowrap;
}

.np-table th {
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.np-table th:first-child,
.np-table td:first-child {
  text-align: left;
}

.np-del {
  font-size: 12px;
  color: #94a3b8;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
}

.np-del:hover {
  color: #ef4444;
  border-color: #fecaca;
  background: #fef2f2;
}

.np-empty {
  margin: 0;
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.7;
}

.np-io {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.np-io-btn {
  flex: 1 1 30%;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 11px 8px;
  min-height: 46px;
  cursor: pointer;
}

.np-io-btn:hover {
  background: #e2e8f0;
}

.np-io-msg {
  margin: 10px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #0f766e;
}

.np-io-msg.np-io-error {
  color: #b45309;
}

@media (max-width: 430px) {
  .np-result-value {
    font-size: 32px;
  }
  .np-stat-big .np-stat-value {
    font-size: 27px;
  }
  .np-tab {
    font-size: 12.5px;
  }
}
