* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: #f4f5f7;
  color: #1a1a2e;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

header h1 {
  color: #ff4757;
  margin: 8px 0 4px;
}

header .sub { color: #6b7280; margin: 0 0 24px; }

.back {
  display: inline-block;
  margin-bottom: 12px;
  color: #ff4757;
  text-decoration: none;
  font-weight: 600;
}
.back:hover { text-decoration: underline; }

.trip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.danger-outline {
  margin: 8px 0 0;
  background: transparent;
  color: #ef4444;
  border: 1px solid #ef4444;
  white-space: nowrap;
}
.danger-outline:hover { background: #fee2e2; }

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

h2 { margin: 0 0 12px; font-size: 1.1rem; }

label { display: block; font-size: 0.85rem; font-weight: 600; margin: 10px 0 4px; }

input, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 60px; }

.row { display: flex; gap: 12px; }
.row > div { flex: 1; }

button {
  margin-top: 14px;
  padding: 9px 18px;
  background: #ff4757;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: #e83e4c; }
button.secondary { background: #6b7280; }
button.secondary:hover { background: #565f6b; }
button.danger { background: transparent; color: #ef4444; padding: 4px 8px; margin: 0; }
button.danger:hover { background: #fee2e2; }

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

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #eee;
}
.list-item:last-child { border-bottom: none; }
.list-item .meta { flex: 1; }
.list-item .when { color: #ff4757; font-weight: 700; font-size: 0.85rem; }
.list-item .name { font-weight: 600; font-size: 1.05rem; margin: 2px 0; }
.list-item .details { color: #4b5563; font-size: 0.9rem; white-space: pre-wrap; }
.list-item a { color: #2563eb; font-size: 0.85rem; text-decoration: none; }
.list-item a:hover { text-decoration: underline; }

.trip-link {
  display: block;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 10px;
  text-decoration: none;
  color: #1a1a2e;
  font-weight: 600;
}
.trip-link:hover { border-color: #ff4757; }

.empty { color: #9ca3af; padding: 8px 0; }
.msg { font-size: 0.85rem; margin-top: 8px; min-height: 1em; }
.msg.error { color: #ef4444; }
.msg.ok { color: #16a34a; }

/* ---- day dividers ---- */
.day-divider {
  list-style: none;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ff4757;
  padding: 14px 0 6px;
  margin-top: 6px;
  border-bottom: 2px solid #ffe3e6;
}
.day-divider:first-child { padding-top: 0; }

/* ---- list items (multi-type) ---- */
.list-item .icon { font-size: 1.6rem; line-height: 1.2; width: 32px; text-align: center; flex: 0 0 auto; }
.list-item .type-tag {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  background: #f1f2f4;
  border-radius: 4px;
  padding: 1px 6px;
  margin: 2px 0 4px;
}
.list-item .ex { font-size: 0.85rem; color: #374151; margin-top: 2px; }
.list-item .ex a { font-size: 0.85rem; }
.badges { white-space: nowrap; }
.badge {
  display: inline-block;
  font-size: 0.85rem;
  background: #fff4e5;
  border: 1px solid #ffd8a8;
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
}
.actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex: 0 0 auto; }
.link-btn { background: transparent; color: #2563eb; padding: 4px 8px; margin: 0; font-weight: 600; }
.link-btn:hover { background: #eff6ff; }
.req { color: #ef4444; }

/* ---- modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
  z-index: 100;
}
.modal-backdrop.hidden { display: none; }
.modal {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  color: #6b7280;
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 8px;
  margin: 0;
}
.modal-close:hover { background: #f1f2f4; }
.modal h2 { margin: 0 0 14px; }

.type-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.type-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin: 0;
  background: #f7f8fa;
  color: #1a1a2e;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.type-tile:hover { border-color: #ffb3ba; background: #fff; }
.type-tile.active { border-color: #ff4757; background: #fff0f1; }
.type-tile:disabled { opacity: 0.55; cursor: default; }
.type-tile.active:disabled { opacity: 1; }
.tile-icon { font-size: 1.2rem; }

.field { margin-bottom: 4px; }
.field.hidden { display: none; }
label.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin: 12px 0 4px;
}
label.inline input { width: auto; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-actions button { margin-top: 8px; }
