:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --warn-bg: #fef9c3;
  --warn-text: #854d0e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.app-header {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header h1 { margin: 0; font-size: 18px; font-weight: 600; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 12px 76px;
}

.page { display: none; }
.page.active { display: block; }
.hidden { display: none !important; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.card h2 { margin: 0 0 10px; font-size: 16px; }
.card h3 { margin: 14px 0 6px; font-size: 14px; }

textarea, input, select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; }
input[type="checkbox"] { width: auto; }

.field { display: block; margin: 10px 0; }
.field-label { display: block; margin: 10px 0 4px; font-weight: 600; }
.field.check { display: flex; align-items: center; gap: 8px; }

.params-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
@media (max-width: 480px) {
  .params-grid { grid-template-columns: 1fr; }
}

.btn {
  display: inline-block;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: #f8fafc; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.btn-col { display: flex; flex-direction: column; gap: 10px; }

.meal-list { display: flex; flex-direction: column; gap: 6px; }
.meal-row { display: flex; gap: 8px; align-items: center; }
.meal-row input { width: 90px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fafafa;
}
.list-item.uncertain { border-color: #eab308; background: var(--warn-bg); }
.list-item .row { display: flex; align-items: center; gap: 8px; }
.list-item .name { font-weight: 600; }
.list-item .muted { color: var(--muted); font-size: 13px; }
.list-item input[type="number"], .list-item input[type="text"] { width: 110px; }

.stay-row, .spot-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.stay-row:last-child, .spot-row:last-child { border-bottom: none; }
.stay-row input, .spot-row input { width: 96px; }
.stay-row input.name-input, .spot-row input.name-input { flex: 1; min-width: 130px; width: auto; }

.rec-summary { padding: 8px 12px; border-radius: 8px; background: #eff6ff; color: #1d4ed8; margin-bottom: 12px; }

.quote-preview .line { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.quote-preview .line:last-child { border-bottom: none; }
.quote-preview .line.total { font-weight: 700; font-size: 16px; color: var(--primary); }
.quote-preview .line .v { font-weight: 600; }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { padding: 7px 12px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.defaults-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.defaults-grid label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.search-row { display: flex; gap: 8px; margin: 8px 0; }

table.car-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.car-table th, table.car-table td { border: 1px solid var(--border); padding: 5px 4px; text-align: center; }
table.car-table th { background: #f1f5f9; }
table.car-table input { width: 64px; padding: 4px; font-size: 13px; }
table.car-table td.label { text-align: left; white-space: nowrap; }

.warn { color: var(--warn-text); background: var(--warn-bg); padding: 8px 10px; border-radius: 8px; }
.msg { color: var(--muted); min-height: 1.2em; }

.app-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  z-index: 10;
}
.nav { display: flex; max-width: 720px; margin: 0 auto; }
.nav-btn {
  flex: 1;
  padding: 12px 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}
.nav-btn.active { color: var(--primary); font-weight: 700; }

.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 520px; max-height: 86vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
#modalBody { padding: 14px; }
.seg-row { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.seg-row input { width: 70px; }
