:root {
  --bg: #f4f1ea; --card: #fffdf8; --ink: #1d2a2f; --muted: #6b767a; --line: #e2ddd2;
  --sea: #0f7c86; --sea-soft: #d8eef0; --sun: #e08a2c; --warn: #a0521b; --user: #e8f3f4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11181b; --card: #192327; --ink: #e8ecec; --muted: #94a2a6; --line: #2a383d;
    --sea: #4fc1cb; --sea-soft: #1d3a3e; --sun: #f0a552; --warn: #f0a552; --user: #1d3a3e;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 .6rem; color: var(--sea); text-transform: uppercase; letter-spacing: .04em; }
h3 { font-size: 1rem; margin: .4rem 0; }
small { display: block; color: var(--muted); font-size: .85rem; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
button { background: var(--sea); color: #fff; border: 0; border-radius: 8px; padding: .55rem 1rem; font: inherit; cursor: pointer; }
button:disabled { opacity: .5; }
button.link { background: none; color: var(--muted); padding: 0; text-decoration: underline; }
input, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; min-width: 0; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 16px; background: linear-gradient(120deg, var(--sea), #136b8a); color: #fff; }
.top p { margin: .2rem 0 0; opacity: .9; }
.top .out { color: #fff; opacity: .85; font-size: .9rem; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; max-width: 1100px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; min-width: 0; }
.span2 { grid-column: span 2; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 84px 1fr; gap: .8rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline .d { font-weight: 600; font-size: .85rem; color: var(--muted); padding-top: .1rem; }
.timeline .fly .d::before { content: "✈ "; color: var(--sea); }
.timeline .stay { background: var(--sea-soft); border-radius: 10px; padding: .6rem .6rem; border-top: 0; margin: .2rem 0; }
.timeline .stay .d { color: var(--sea); }

.todos { list-style: none; margin: 0 0 .8rem; padding: 0; }
.todos li { display: flex; align-items: flex-start; gap: .4rem; padding: .35rem 0; border-top: 1px solid var(--line); }
.todos li:first-child { border-top: 0; }
.todos label { display: flex; gap: .55rem; flex: 1; cursor: pointer; }
.todos input { margin-top: .3rem; accent-color: var(--sea); }
.todos em { color: var(--sun); font-style: normal; font-size: .85rem; white-space: nowrap; }
.todos li.done span { text-decoration: line-through; color: var(--muted); }
.todos .x { background: none; color: var(--muted); padding: 0 .3rem; font-size: 1.1rem; line-height: 1; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; }
.row input[name=text], .row textarea { flex: 1 1 200px; }

.mem { padding: .5rem 0 .7rem; border-bottom: 1px solid var(--line); margin-bottom: .7rem; }
.mem span { display: block; font-size: .9rem; }

.chathead { display: flex; justify-content: space-between; align-items: baseline; }
#log { max-height: 60vh; overflow-y: auto; margin-bottom: .8rem; display: flex; flex-direction: column; gap: .6rem; }
.m { padding: .6rem .8rem; border-radius: 10px; max-width: 90%; overflow-wrap: anywhere; }
.m p { margin: 0; }
.m ul { margin: .2rem 0; padding-left: 1.2rem; }
.m.user { background: var(--user); align-self: flex-end; }
.m.assistant { border: 1px solid var(--line); align-self: flex-start; }
.m.pending { color: var(--muted); }
.hint { font-style: italic; }

.small { font-size: .8rem; text-transform: none; letter-spacing: 0; font-weight: 400; }
.leg { padding: .7rem 0; border-top: 1px solid var(--line); }
.leg:first-of-type { border-top: 0; }
.leghead { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; }
.price { margin-left: auto; font-size: 1.15rem; font-weight: 700; color: var(--sea); }
.lvl { font-size: .75rem; padding: .1rem .5rem; border-radius: 99px; background: var(--sea-soft); color: var(--muted); }
.lvl.low { background: #d6f0dc; color: #1e6b34; }
.lvl.high { background: #f6dfcf; color: var(--warn); }
.opts { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: .4rem; }
.opts td { padding: .25rem .4rem .25rem 0; border-top: 1px dashed var(--line); white-space: nowrap; }
.opts td:nth-child(2) { white-space: normal; }
.card .leg { overflow-x: auto; }
a { color: var(--sea); }

.login { max-width: 340px; margin: 18vh auto; padding: 0 16px; }
.login form { display: flex; flex-direction: column; gap: .8rem; margin-top: 1rem; }
.login label { display: flex; flex-direction: column; gap: .3rem; }
.err { color: #c0392b; margin: 0; }
