:root {
  --accent: #2d6a4f;
  --accent-light: #e5f2ec;
  --danger: #c0392b;
  --text: #23292b;
  --muted: #6b7680;
  --border: #e1e4e6;
  --bg: #f7f8f7;
  --card-bg: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 70px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--accent);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  font-size: 19px;
  margin: 0;
  font-weight: 700;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.9;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffd166;
  display: inline-block;
}
.dot.online { background: #7cb518; }
.dot.offline { background: #c0392b; }

main#app {
  flex: 1;
  padding: 12px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

.tabbar {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  z-index: 10;
}

.tab-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 4px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: var(--muted);
  font-family: inherit;
}

.tab-btn.active {
  color: var(--accent);
  font-weight: 700;
}

.tab-icon { font-size: 20px; }

h2.section-title {
  font-size: 16px;
  margin: 18px 0 8px;
  color: var(--accent);
}
h2.section-title:first-child { margin-top: 0; }

.day-block {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  scroll-margin-top: 70px;
}

.trip-summary-card {
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.trip-summary-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.trip-summary-dates { font-size: 14px; opacity: 0.9; }
.trip-summary-countdown { font-size: 14px; margin-top: 8px; font-weight: 600; }

.day-pill-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.day-pill {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}
.day-pill.today { border-color: var(--accent); }
.day-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.day-pill-weekday { font-weight: 600; font-size: 12px; }
.day-pill-date { font-size: 13px; }

.overview-day-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.overview-day-header { font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.overview-weather {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  margin-bottom: 10px;
}
.overview-weather.muted { color: var(--muted); font-size: 13px; }
.overview-weather-icon { font-size: 22px; }
.overview-weather-temps { margin-inline-start: auto; font-weight: 600; }
.overview-day-stats { font-size: 14px; color: var(--text); margin-bottom: 8px; }

.day-header {
  background: var(--accent-light);
  padding: 10px 14px;
  font-weight: 700;
  color: var(--accent);
  font-size: 14px;
}

.item-card {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.item-card.done { opacity: 0.55; }
.item-card.done .item-title { text-decoration: line-through; }

.item-card input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.item-body { flex: 1; min-width: 0; }

.item-title {
  font-weight: 700;
  font-size: 15px;
}

.item-meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.item-note {
  font-size: 13px;
  color: var(--text);
  margin-top: 4px;
  white-space: pre-wrap;
}

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
  margin-inline-end: 6px;
}

.item-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
}
.link-btn.danger { color: var(--danger); }

.empty-msg {
  color: var(--muted);
  font-size: 14px;
  padding: 16px 4px;
  text-align: center;
}

.add-btn {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px dashed var(--accent);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.top-add-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-bottom: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

form.inline-form {
  background: var(--card-bg);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 12px;
  margin: 8px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

form.inline-form label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

form.inline-form input,
form.inline-form select,
form.inline-form textarea {
  font-family: inherit;
  font-size: 15px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 100%;
}

form.inline-form textarea { resize: vertical; min-height: 50px; }

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-primary, .btn-secondary {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: #eee; color: var(--text); }

.filter-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.filter-chip {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.assign-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.assign-row select {
  flex: 1;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 13px;
}

.budget-summary {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.budget-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 15px;
}
.budget-row.total { font-weight: 700; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 10px; }
.budget-row.remaining.negative { color: var(--danger); font-weight: 700; }

.budget-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.budget-input-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
}

.cat-bar-row {
  margin: 6px 0;
}
.cat-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 3px;
}
.cat-bar-track {
  background: var(--accent-light);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
}
.cat-bar-fill {
  background: var(--accent);
  height: 100%;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
}
.task-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.task-row.done .task-text { text-decoration: line-through; color: var(--muted); }
.task-text { flex: 1; font-size: 15px; }
