:root {
  --primary: #06c;
  --primary-dark: #1d1d1f;
  --bg: #f5f5f7;
  --card-bg: #fff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: #d2d2d7;
  --success: #248a3d;
  --danger: #d70015;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 70px;
  -webkit-font-smoothing: antialiased;
}

.app-header {
  background: #000;
  color: #fff;
  padding: 54px 20px 42px;
  text-align: left;
}

.app-header h1 {
  max-width: 720px;
  margin: 0 auto 8px;
  font-size: clamp(2rem, 7vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.subtitle {
  max-width: 720px;
  margin: 0 auto;
  color: #a1a1a6;
  font-size: 0.95rem;
  letter-spacing: 0;
}

.tab-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(210, 210, 215, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  flex: 1 0 auto;
  padding: 14px 12px;
  font-size: 0.82rem;
  border: none;
  background: none;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

#main-content {
  padding: 28px 16px 48px;
  max-width: 760px;
  margin: 0 auto;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-panel h2 {
  font-size: 1.7rem;
  letter-spacing: -0.025em;
  margin: 4px 4px 20px;
}

.card, .day-card, .item-card {
  background: var(--card-bg);
  border: 1px solid rgba(210, 210, 215, 0.55);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.045);
}

.empty-tip {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 24px 0;
}

/* Flight card */
.flight-card {
  background: var(--card-bg);
  border: 1px solid rgba(210, 210, 215, 0.55);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.045);
}

.flight-card-head,
.flight-card-foot,
.day-flight-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.flight-kind,
.flight-status {
  font-size: 0.78rem;
  color: var(--muted);
}

.flight-status {
  color: var(--success);
  font-weight: 600;
}

.flight-airline {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 10px 0 22px;
}

.flight-route-grid {
  display: grid;
  grid-template-columns: minmax(74px, 1fr) minmax(70px, 1.1fr) minmax(74px, 1fr);
  align-items: center;
  gap: 6px;
}

.flight-stop {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.flight-stop strong {
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: 0;
}

.flight-stop span {
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flight-stop small {
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 600;
}

.flight-arrival {
  text-align: right;
  align-items: flex-end;
}

.flight-line {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 70px;
  height: 42px;
  color: var(--muted);
  font-size: 0.7rem;
}

.flight-line i {
  position: absolute;
  left: 0;
  right: 0;
  top: 25px;
  border-top: 1px solid #cbd3dc;
}

.flight-line b {
  position: relative;
  z-index: 1;
  padding: 0 8px;
  background: var(--card-bg);
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 400;
}

.flight-line span {
  position: absolute;
  top: 0;
  white-space: nowrap;
}

.flight-card-foot {
  border-top: 1px solid var(--border);
  margin-top: 20px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 0.76rem;
}

.flight-card-foot span:last-child {
  max-width: 68%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Itinerary day card */
.day-card .day-header {
  margin-bottom: 18px;
}

.day-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.day-label {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.day-card .day-title {
  display: block;
  font-weight: 700;
  color: var(--text);
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.day-card .day-date {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.day-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.day-card li {
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.day-info-block {
  font-size: 0.85rem;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: #f7f9fb;
  line-height: 1.5;
}

.day-info-block.flight-block { background: #f0f7ff; }
.day-info-block.stay-block { background: #f2f8f3; }
.day-info-block.car-block { background: #fff7ed; }

.day-flight-top {
  justify-content: flex-start;
  margin-bottom: 5px;
}

.day-flight-route {
  display: block;
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-flight-route b {
  color: var(--primary);
  margin: 0 4px;
}

/* Stay & car cards */
.item-card .item-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}

.item-card .item-meta {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

/* Cost summary */
#cost-summary .total-amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
}

.cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.cost-row:last-child { border-bottom: none; }

.cost-row .cost-info { flex: 1; min-width: 0; }

.cost-row .cost-amount {
  font-weight: 600;
  white-space: nowrap;
}

.cost-row .cost-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.cost-row .cost-actions button {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 2px 5px;
  line-height: 1;
}

.unpaid-tag {
  background: #fdecea;
  color: var(--danger);
}

.cost-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 6px 0 0;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: #eaf2f8;
  color: var(--primary);
  margin-right: 6px;
}

/* Section header with action button (e.g. cost tab) */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 4px 12px;
}

.section-header h2 {
  margin: 0;
}

.btn-add {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 980px;
  padding: 9px 16px;
  font-size: 0.82rem;
  cursor: pointer;
}

/* Cost add/edit modal */
.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-box {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-box h3 {
  margin: 0 0 14px;
}

.modal-box label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.modal-box input[type="text"],
.modal-box input[type="number"],
.modal-box select {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text);
  box-sizing: border-box;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-label input {
  width: auto;
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.btn-primary, .btn-secondary {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-secondary {
  background: #eee;
  color: var(--text);
}
