*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f0;
  color: #1a1a1a;
  min-height: 100vh;
}

/* ── Auth ─────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.auth-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  width: 340px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  text-align: center;
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-card p  { color: #777; font-size: 0.9rem; margin-bottom: 28px; }

/* ── App shell ────────────────────────────────────── */
header {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
header h1 { font-size: 1.1rem; font-weight: 600; }
header .actions { display: flex; gap: 10px; align-items: center; }

main { max-width: 680px; margin: 0 auto; padding: 24px 16px 80px; }

/* ── Calendar ─────────────────────────────────────── */
#calendar { margin-bottom: 8px; }
.calendar-month { margin-bottom: 20px; }
.cal-month-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: #333;
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}
.cal-weekdays span {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cal-cell.empty-cell { visibility: hidden; }
.cal-cell.out-of-trip { color: #ccc; }
.cal-cell.in-trip {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s;
}
.cal-cell.in-trip:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.cal-cell.selected {
  background: #2563eb;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.cal-cell.selected .cal-daynum { color: #fff; }
.cal-daynum { font-size: 0.85rem; font-weight: 600; margin-bottom: 2px; }
.cal-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  justify-content: center;
  font-size: 0.65rem;
  line-height: 1;
}

/* ── Day card ─────────────────────────────────────── */
.day-card {
  background: #fff;
  border-radius: 10px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  overflow: hidden;
}
.day-header {
  padding: 12px 16px;
  background: #fafaf8;
  border-bottom: 1px solid #f0f0ec;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.day-header .dow  { font-weight: 700; font-size: 1rem; }
.day-header .date { color: #888; font-size: 0.85rem; }
.day-header .day-add-btn { margin-left: auto; }

/* ── Event row ────────────────────────────────────── */
.event-row {
  display: flex;
  align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid #f5f5f0;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.event-row:last-child { border-bottom: none; }
.event-row:hover { filter: brightness(0.97); }

.event-row.type-flight,
.event-row.type-transport { background: #dbeafe; }
.event-row.type-hotel     { background: #dcfce7; }
.event-row.type-activity  { background: #fef9c3; }
.event-row.type-other     { background: #fee2e2; }

.event-daterange { font-size: 0.8rem; color: #999; margin-top: 2px; }

.event-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.attachment-chip {
  display: inline-block;
  font-size: 0.78rem;
  background: #f0f0ec;
  color: #333;
  padding: 3px 9px;
  border-radius: 5px;
  text-decoration: none;
}
.attachment-chip:hover { background: #e5e5e0; }

#attachment-list { margin-top: 8px; }
.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 6px 10px;
  background: #fafaf8;
  border: 1px solid #eee;
  border-radius: 6px;
  margin-top: 6px;
}
.attachment-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #ccc;
  font-size: 0.9rem;
  padding: 0 4px;
}
.attachment-remove:hover { color: #e53935; }

.event-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
  background: rgba(255,255,255,0.65);
}

.event-body { flex: 1; }
.event-title { font-weight: 600; font-size: 0.95rem; }
.event-time  { font-size: 0.8rem; color: #999; margin-top: 2px; }
.event-details {
  font-size: 0.82rem;
  color: #666;
  margin-top: 4px;
  white-space: pre-wrap;
}
.event-ref {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.75rem;
  background: #f0f0ec;
  padding: 2px 7px;
  border-radius: 4px;
  color: #555;
  font-family: monospace;
}

.event-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: #ccc;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}
.event-delete:hover { color: #e53935; }

/* ── Empty state ──────────────────────────────────── */
.empty { text-align: center; color: #bbb; padding: 60px 0; font-size: 0.95rem; }
.empty.small { padding: 24px 0; font-size: 0.85rem; }

/* ── Modal ────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  width: 440px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  max-height: 90vh;
  overflow-y: auto;
}
.modal h2 { font-size: 1.1rem; margin-bottom: 20px; }

/* ── Forms ────────────────────────────────────────── */
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-row label .label-hint {
  font-weight: 400;
  text-transform: none;
  color: #aaa;
  letter-spacing: normal;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 7px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fafaf8;
  transition: border-color 0.15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: #4a90e2;
  background: #fff;
}
.form-row textarea { resize: vertical; min-height: 70px; }
.form-row-half { display: flex; gap: 10px; }
.form-row-half .form-row { flex: 1; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  padding: 9px 18px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-secondary { background: #f0f0ec; color: #333; }
.btn-danger { background: #e53935; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }

/* ── Toast ────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1a1a1a;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  transition: transform 0.25s;
  z-index: 200;
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 600px) {
  .modal { padding: 20px; }
}
