:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --primary: #1976d2;
  --text: #1f2937;
  --muted: #64748b;
  --border: #d1d5db;
  --accent: #0f172a;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(circle at top, rgba(25,118,210,.12), transparent 40%), var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px;
}

.hero {
  max-width: 70%;
}

.brand {
  margin: 0;
  color: var(--primary);
  font-weight: 700;
}

h1 {
  margin: 6px 0 4px;
  font-size: 1.6rem;
  line-height: 1.1;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.tab-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  padding: 0 18px 14px;
}

.tab-button {
  padding: 12px 8px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: rgba(255,255,255,.9);
  color: var(--text);
  font-weight: 600;
}

.tab-button.active {
  background: var(--primary);
  color: white;
}

.content {
  flex: 1;
  padding: 0 18px 18px;
}

.tab-panel {
  display: none;
}

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

.section-title {
  margin: 0 0 14px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.overview-card,
.card,
.city-card {
  border-radius: 22px;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 18px 40px rgba(15,23,42,0.08);
  border: 1px solid rgba(15,23,42,0.08);
}

.overview-summary {
  padding: 18px 18px 16px;
  margin-bottom: 18px;
}

.route-text {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.section-grid {
  display: grid;
  gap: 16px;
}

.card {
  display: grid;
  grid-template-columns: 110px 1fr;
  overflow: hidden;
}

.card-image,
.city-image {
  min-height: 110px;
  background-size: cover;
  background-position: center;
}

.card-content {
  padding: 16px;
}

.card-subtitle {
  margin: 10px 0 8px;
  font-size: 0.98rem;
  color: var(--muted);
}

.card-text {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
}

.tag {
  display: inline-flex;
  margin-top: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  background: rgba(25,118,210,0.12);
  color: var(--primary);
}

.card-actions,
.city-card .card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  grid-column: 1 / -1;
}

.image-edit-button {
  font-size: 0.86rem;
  padding: 10px 12px;
  border-radius: 14px;
}

.item-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--text);
  line-height: 1.8;
}

.todo-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(15,23,42,.08);
  cursor: pointer;
}

.todo-item input {
  display: none;
}

.checkbox-circle {
  width: 22px;
  height: 22px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  background: white;
}

.checkbox-circle::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity .2s ease, transform .2s ease;
}

.todo-item input:checked + .checkbox-circle::after {
  opacity: 1;
  transform: scale(1);
}

.todo-text {
  flex: 1;
  color: var(--text);
}

.todo-text.done {
  text-decoration: line-through;
  color: var(--muted);
}

.city-card {
  display: grid;
  grid-template-columns: 100px 1fr;
  overflow: hidden;
}

.city-info {
  padding: 14px 16px;
}

.city-info h3 {
  margin: 0 0 4px;
}

.city-info p {
  margin: 0;
  color: var(--muted);
}

h2 {
  margin-top: 0;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  font-size: 1rem;
  outline: none;
  background: var(--surface);
  color: var(--text);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.form-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

button {
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .15s ease, box-shadow .15s ease;
  background: var(--primary);
  color: #fff;
}

button.secondary {
  background: #e2e8f0;
  color: var(--text);
}

button:hover {
  transform: translateY(-1px);
}

.notes-list {
  display: grid;
  gap: 12px;
}

.note-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.95);
  box-shadow: 0 8px 20px rgba(15,23,42,.06);
  border: 1px solid rgba(15,23,42,.06);
}

.note-card h3,
.note-card p {
  margin: 0;
}

.note-card p {
  white-space: pre-wrap;
}

.trip-summary {
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: rgba(25,118,210,.09);
  color: var(--text);
  border: 1px solid rgba(25,118,210,.18);
  line-height: 1.6;
}

.note-meta {
  margin-top: 8px;
  font-size: .92rem;
  color: var(--muted);
}

.app-footer {
  padding: 14px 18px 18px;
  font-size: .95rem;
  color: var(--muted);
}

.icon-button {
  border: 1px solid rgba(15,23,42,.12);
  background: white;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 1.1rem;
}

@media (max-width: 520px) {
  .tab-bar {
    grid-template-columns: repeat(1, 1fr);
  }
}

.dark {
  color-scheme: dark;
  --bg: #07101a;
  --surface: #112131;
  --primary: #5b8cff;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #273449;
  --accent: #f8fafc;
  background: radial-gradient(circle at top, rgba(91,140,255,.16), transparent 40%), var(--bg);
}

.dark textarea,
.dark input,
.dark select {
  background: #0f1f34;
}

.dark .tab-button {
  background: rgba(255,255,255,.06);
  color: var(--text);
}

.dark .tab-button.active {
  color: white;
}

.dark button.secondary {
  background: #1f334a;
  color: var(--text);
}
