:root {
  --paper: #f6efe1; --paper-2: #fbf7ee; --ink: #2d2620; --muted: #7a6c5d; --rule: #e2d5bd;
  --accent: #8c3b2a; --accent-2: #2f5d50; --gold: #b8892f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 16px/1.55 var(--sans);
  background: var(--paper) radial-gradient(circle at 20% 0%, #fffaf0 0, transparent 60%);
}
h1, h2, h3, .brand { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; }
h1 { font-size: 2.1rem; margin: .2rem 0; }
h2 { font-size: 1.35rem; margin: 0 0 .6rem; border-bottom: 1px solid var(--rule); padding-bottom: .3rem; }
h3 { font-size: 1.05rem; margin: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.masthead { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem;
  padding: .8rem 1.2rem; border-bottom: 3px double var(--rule); background: var(--paper-2); }
.brand { font-size: 1.4rem; color: var(--ink); text-decoration: none; }
.brand small { font: italic .85rem var(--serif); color: var(--muted); margin-left: .3rem; }
.brand-mark { color: var(--accent); }
.masthead nav { display: flex; gap: 1rem; align-items: center; }
.masthead nav form { display: inline; }
.page { max-width: 1180px; margin: 0 auto; padding: 1.2rem; }
.colophon { text-align: center; font: italic .9rem var(--serif); color: var(--muted); padding: 2rem 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.crumbs { margin: 0; font-size: .9rem; }
.card { background: var(--paper-2); border: 1px solid var(--rule); border-radius: 6px; padding: 1rem 1.1rem; margin-bottom: 1rem;
  box-shadow: 0 1px 0 #fff inset, 0 2px 6px rgba(80,60,30,.07); }
.narrow { max-width: 420px; margin: 3rem auto; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.trip-card { color: inherit; text-decoration: none; display: block; }
.trip-card:hover { border-color: var(--gold); }
.route-line { font: italic .95rem var(--serif); color: var(--muted); }
.two-col { display: grid; gap: 1rem; grid-template-columns: 3fr 2fr; }
.three-col { display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .two-col, .three-col { grid-template-columns: 1fr; } h1 { font-size: 1.7rem; } }
.route { list-style: none; counter-reset: stop; padding: 0; margin: 0; }
.route-stop { counter-increment: stop; display: flex; justify-content: space-between; gap: .5rem; padding: .55rem 0; border-bottom: 1px dashed var(--rule); }
.route-stop::before { content: counter(stop); font: 600 1rem var(--serif); color: var(--gold); min-width: 1.8rem; }
.route-main { flex: 1; display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: baseline; }
.route-name { font: 600 1.08rem var(--serif); color: var(--ink); text-decoration: none; }
.route-name:hover { color: var(--accent); }
.counts { font-size: .8rem; width: 100%; }
.route-actions { display: flex; gap: .2rem; }
.badge { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; padding: .05rem .45rem; border-radius: 999px; border: 1px solid; }
.badge-idea { color: var(--muted); } .badge-planned { color: var(--accent-2); } .badge-visited { color: var(--accent); }
form { margin: 0; }
.stack { display: flex; flex-direction: column; gap: .6rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row > label { flex: 1; min-width: 140px; }
label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], textarea, select {
  font: inherit; color: var(--ink); background: #fffdf8; border: 1px solid var(--rule); border-radius: 4px; padding: .45rem .55rem; width: 100%; }
textarea { font-family: var(--serif); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
.btn, input[type=submit].btn { font: 600 .95rem var(--sans); background: var(--accent); color: #fff; border: 0; border-radius: 4px;
  padding: .5rem .9rem; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { filter: brightness(1.08); }
.btn-small { padding: .3rem .7rem; font-size: .85rem; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-danger { background: #7d2a1f; margin-top: .5rem; }
.icon-btn, .link-button { background: none; border: 0; cursor: pointer; font-size: 1rem; color: var(--muted); padding: .1rem .3rem; }
.icon-btn:hover, .link-button:hover { color: var(--accent); }
.icon-btn:disabled { opacity: .25; cursor: default; }
.link-button { color: var(--accent); font: inherit; }
.inline-form { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.inline-form > input[type=text] { flex: 1 1 160px; }
.inline-form.stacked { flex-direction: column; }
.inline-form details { display: flex; flex-direction: column; gap: .4rem; }
.inline-form details > * { margin-top: .3rem; }
.item-row, .entry-head, .note-head { display: flex; align-items: flex-start; gap: .4rem; }
.item-row form, .entry-head form, .item-actions form { display: inline; }
.checklist-item, .entry, .note { display: block; padding: .35rem 0; border-bottom: 1px dotted var(--rule); }
.item-body { flex: 1; display: flex; flex-direction: column; }
.checklist-item.done .item-title { text-decoration: line-through; color: var(--muted); }
.item-actions { margin-left: auto; white-space: nowrap; }
.entry-title { flex: 1; font-family: var(--serif); font-size: 1.02rem; }
.entry.starred .entry-title { font-weight: 600; }
.star { color: var(--gold); }
.prio { color: var(--gold); margin-left: .3rem; letter-spacing: .1em; }
.entry-desc { font-size: .9rem; color: #4a3f35; margin-left: 1.9rem; }
.prose p:first-child { margin-top: 0; } .prose p:last-child { margin-bottom: 0; }
.prose blockquote { border-left: 3px solid var(--gold); margin: .5rem 0; padding-left: .8rem; font-style: italic; }
.list-theme h2 { color: var(--accent-2); } .list-eat_drink h2 { color: var(--accent); }
.journal .notes { margin-top: 1rem; }
.flash { padding: .6rem .9rem; border-radius: 4px; margin-bottom: 1rem; background: #eef3e8; border: 1px solid #c9d8bb; }
.flash-alert { background: #f8e9e4; border-color: #e3bfb3; }
.errors { color: #7d2a1f; font-size: .85rem; }
.add-place summary { cursor: pointer; color: var(--accent); margin-top: .8rem; }
turbo-frame { display: block; }
.messages { display: flex; flex-direction: column; gap: .7rem; max-height: 65vh; overflow-y: auto; padding: .3rem; margin-bottom: 1rem; }
.message { max-width: 85%; padding: .6rem .85rem; border-radius: 10px; border: 1px solid var(--rule); }
.message-traveler { align-self: flex-end; background: #fffdf8; border-bottom-right-radius: 2px; }
.message-indy { align-self: flex-start; background: #eef1e8; border-color: #cfd8c2; border-bottom-left-radius: 2px; font-family: var(--serif); }
.message-indy .message-meta strong { color: var(--accent-2); }
.message-meta { font-size: .85rem; margin-bottom: .2rem; }
.empty-chat { text-align: center; font-style: italic; }
@media (max-width: 600px) { .message { max-width: 95%; } }
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-block; vertical-align: middle; box-shadow: 0 0 0 2px var(--paper-2), 0 0 0 3px var(--rule); }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; color: #fffaf0; font: 600 1rem var(--serif); letter-spacing: .03em; }
.agent-head { display: flex; gap: .9rem; align-items: center; margin-bottom: .6rem; }
.agent-head h2 { border: 0; margin: 0; padding: 0; }
.agent-card.inactive { opacity: .6; }
.agent-actions form { display: inline; }
.avatar-preview { display: flex; }
.checkbox { flex-direction: row; align-items: center; gap: .4rem; }
.message-row { display: flex; gap: .5rem; align-items: flex-end; max-width: 88%; }
.message-row.from-traveler { align-self: flex-end; flex-direction: row-reverse; }
.message-row.from-agent { align-self: flex-start; }
.message-row .message { max-width: 100%; }
.addressed { font-size: .75rem; color: var(--muted); font-style: italic; }
