:root {
  --bg: #f0f4f2;
  --surface: #fff;
  --text: #1a2420;
  --muted: #5a6b64;
  --border: #d5e0db;
  --primary: #1a5f4a;
  --primary-soft: #e6f3ee;
  --personal: #8a6d3b;
  --personal-bg: #faf3e6;
  --danger: #b33a3a;
  --radius: 14px;
  --font: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}
.hidden { display: none !important; }

.lock-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #1a5f4a, #0f3d30);
}
.lock-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 22px;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.lock-icon { font-size: 2rem; margin-bottom: 8px; }
.lock-card h1 { margin: 0 0 12px; font-size: 1.2rem; }
.lock-card p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.6; }
.lock-sub { margin-top: 12px !important; font-size: 0.8rem !important; }

#app { max-width: 480px; margin: 0 auto; padding-bottom: 32px; }
.header {
  background: linear-gradient(145deg, #1a5f4a, #2d8f6e);
  color: #fff;
  padding: 18px 20px 22px;
}
.logo { margin: 0; font-size: 1.3rem; }
.tagline { margin: 4px 0 0; font-size: 0.8rem; opacity: .9; }

.summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px;
  margin-top: -16px;
}
.summary-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.summary-label { display: block; font-size: 0.75rem; color: var(--muted); }
.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.summary-value .unit { font-size: 0.85rem; color: var(--muted); margin-left: 2px; }

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 16px 16px 0;
  background: #e4ebe7;
  border-radius: 12px;
  padding: 4px;
}
.tab {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 4px;
  border-radius: 9px;
  cursor: pointer;
  min-height: 44px;
}
.tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.main { padding: 14px 16px 0; }
.panel.hidden { display: none; }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.card-title { margin: 0 0 4px; font-size: 1.05rem; }
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.hint { margin: 0 0 12px; font-size: 0.8rem; color: var(--muted); }
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.field input, .field select, .place-form input, .place-form select,
input[type="month"], input[type="date"] {
  font: inherit;
  font-weight: 500;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fafcfb;
  min-height: 44px;
  width: 100%;
}
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.btn-primary, .btn-secondary, .btn-ghost {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  min-height: 44px;
}
.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
  padding: 12px;
}
.btn-secondary {
  flex: 1;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 10px;
}
.btn-ghost {
  width: 44px;
  background: var(--primary-soft);
  color: var(--primary);
}
.warning {
  background: #fff6e5;
  border: 1px solid #e8c36a;
  color: #6b5320;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
  margin-bottom: 12px;
}
.filter-chips { display: flex; gap: 6px; margin-bottom: 12px; }
.chip {
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.day-group { margin-bottom: 14px; }
.day-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.day-total { color: var(--primary); }
.trip-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  background: #fafcfb;
}
.trip-item.commute { background: var(--personal-bg); opacity: .85; }
.trip-route { font-weight: 600; font-size: 0.9rem; }
.trip-km { font-weight: 700; color: var(--primary); }
.trip-meta { font-size: 0.75rem; color: var(--muted); grid-column: 1; }
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 4px;
}
.badge.business { background: var(--primary-soft); color: var(--primary); }
.badge.personal { background: var(--personal-bg); color: var(--personal); }
.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px;
}
.empty { text-align: center; color: var(--muted); padding: 20px; }
.report-stats { display: grid; gap: 8px; margin-bottom: 14px; }
.stat {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  background: var(--primary-soft);
  border-radius: 10px;
  font-size: 0.9rem;
}
.stat.muted { background: #eee; }
.daily-breakdown {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.daily-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.daily-row:last-child { border-bottom: none; }
.place-form { display: grid; gap: 8px; margin-bottom: 12px; }
.place-list { list-style: none; margin: 0; padding: 0; }
.place-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.export-row { display: flex; gap: 8px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(120%);
  background: #1a2420;
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  opacity: 0;
  transition: .25s;
  z-index: 100;
  max-width: 90%;
}
.toast.show { transform: translateX(-50%); opacity: 1; }
