:root {
  --bg: #e9eef0; --surface: #ffffff; --sunk: #dde5e8; --ink: #14232a; --muted: #55676f; --line: #c5d0d5;
  --accent: #0e5c69; --accent-ink: #ffffff; --mine: #cfe6e8; --tag: #f2b705; --tag-ink: #2a2000; --warn: #a8500a; --ok: #1c7a43;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f181c; --surface: #18252b; --sunk: #122025; --ink: #e5eef0; --muted: #94a7ae; --line: #2c3d44;
    --accent: #56bccb; --accent-ink: #06262c; --mine: #1d4750; --warn: #f0b45a; --ok: #6fd39a; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 18px; line-height: 1.45; }
[hidden] { display: none !important; }
.app { height: 100%; max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; padding: 16px; }
.chat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--accent); color: var(--accent-ink); }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--tag); color: var(--tag-ink); display: grid; place-items: center; font-weight: 700; flex: none; }
.who { flex: 1; min-width: 0; }
.who strong { display: block; }
.who span { font-size: .85rem; opacity: .85; }
.ghost { font: inherit; font-size: .9rem; font-weight: 600; padding: 8px 12px; border-radius: 999px; border: 1px solid currentColor; background: transparent; color: inherit; cursor: pointer; }
#open-side, .close { display: none; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--sunk); }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { background: var(--surface); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: var(--mine); align-self: flex-end; border-bottom-right-radius: 4px; }
.part { display: flex; gap: 10px; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); white-space: normal; }
.part img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }
.part .pn { font-family: var(--mono); font-size: .8rem; color: var(--muted); display: block; }
.price { font-family: var(--mono); background: var(--tag); color: var(--tag-ink); padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 0; }
.chip { font: inherit; font-weight: 600; padding: 12px 18px; border-radius: 999px; border: 2px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; }
.chip:hover { background: var(--accent); color: var(--accent-ink); }
.proof { padding: 12px 16px 0; }
.entry { display: flex; gap: 8px; padding: 12px 16px 16px; }
.entry input { flex: 1; min-width: 0; font: inherit; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.btn { font: inherit; font-weight: 700; padding: 14px 20px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; display: inline-block; }
.btn.alt { background: var(--tag); color: var(--tag-ink); }
:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; }
.side { display: flex; flex-direction: column; gap: 24px; min-width: 0; overflow-y: auto; padding: 4px; }
.panel h2 { margin: 0; font-size: 1.15rem; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rows li > div { min-width: 0; }
.rows small { display: block; color: var(--muted); font-size: .8rem; }
.member { margin: 8px 0 0; font-weight: 700; color: var(--ok); }
.amt { font-family: var(--mono); white-space: nowrap; }
.empty { color: var(--muted); }
.total { display: flex; justify-content: space-between; font-weight: 700; padding-top: 8px; }
.link { font: inherit; font-size: .9rem; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0; align-self: flex-start; }
.pill { font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1.5px solid currentColor; color: var(--muted); white-space: nowrap; }
.pill.warn { color: var(--warn); } .pill.ok { color: var(--ok); }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 0; gap: 0; }
  .chat { border: 0; border-radius: 0; }
  #open-side, .close { display: inline-block; }
  .side { display: none; position: fixed; inset: 0; background: var(--bg); padding: 16px; z-index: 5; }
  .side.open { display: flex; }
}

.msg.typing { color: var(--muted); letter-spacing: .2em; }

.links { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin-top: 8px; }
.note { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }
.panel h3 { font-size: 1rem; margin: 16px 0 4px; }
.asked { margin: 0; padding-left: 1.1em; color: var(--muted); font-size: .9rem; }
.pform { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.pform label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 600; }
.pform input, .pform select { font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.btn.small { padding: 10px 16px; }

.msg .doc { display: inline-block; margin-top: 8px; text-decoration: none; white-space: normal; }
a.link { display: inline-block; margin-top: 8px; }
