:root {
  --bg: #f7f7f5; --panel: #ffffff; --ink: #1d1d1b; --muted: #6b6b66; --line: #e4e3de;
  --accent: #2f6fde; --accent-ink: #ffffff; --soft: #eef3fd;
  --hot: #d6453d; --warm: #d98a1c; --cold: #7d8b99; --good: #2e8b57;
  --radius: 10px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151514; --panel: #1f1f1d; --ink: #ecebe6; --muted: #a09f99; --line: #33332f; --soft: #1e2a40; --accent: #5b8ff0; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; }
button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: 9px 16px; border-radius: 8px; text-decoration: none; display: inline-block; }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); }
button.small, .btn.small { padding: 5px 11px; font-size: 14px; }
button:disabled { opacity: .55; cursor: default; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }

/* public site */
.site-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.site-head nav { display: flex; gap: 16px; align-items: center; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 18px; }
.site-main { max-width: 760px; margin: 0 auto; padding: 24px 16px 60px; }
.site-foot { text-align: center; color: var(--muted); font-size: 14px; padding: 24px; border-top: 1px solid var(--line); }
.hero h1 { font-size: 34px; margin-bottom: 8px; }
.hero p { font-size: 18px; color: var(--muted); }
.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cards li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; font-weight: 600; }
.cards li span { display: block; font-weight: 400; font-size: 14px; color: var(--muted); margin-top: 6px; }
.post-list { list-style: none; padding: 0; }
.post-list li { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.post-list span { color: var(--muted); font-size: 15px; }
.post { font-size: 17px; }
.post .faq details { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 8px 0; }
.post .faq summary { font-weight: 600; cursor: pointer; }
.cta { margin-top: 32px; padding: 20px; background: var(--soft); border-radius: var(--radius); }
.notice { background: #fff4d6; color: #6b4e00; padding: 8px 12px; border-radius: 8px; }

/* chat */
.chat { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 640px; margin: 0 auto; background: var(--panel); }
.chat-head { padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.chat-head small { color: var(--muted); font-weight: 400; display: block; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 80%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.bubble.assistant { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.typing { color: var(--muted); font-style: italic; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; max-width: 95%; }
.slots button { background: transparent; color: var(--accent); }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }

/* booking */
.book { max-width: 560px; margin: 0 auto; padding: 24px 16px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 12px 0; }
.slot-grid button { background: transparent; color: var(--accent); font-size: 14px; }
.slot-grid button.on { background: var(--accent); color: var(--accent-ink); }
.ok { background: var(--panel); border: 1px solid var(--good); border-radius: var(--radius); padding: 16px; }

/* admin */
.admin { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.side .brand { padding: 4px 8px 16px; }
.side a { color: var(--ink); text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.side a.on, .side a:hover { background: var(--soft); color: var(--accent); }
.side .grow { flex: 1; }
.side .mode { font-size: 13px; color: var(--muted); padding: 8px 10px; }
.content { padding: 24px; max-width: 1100px; width: 100%; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--soft); }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.tag.hot { color: #fff; background: var(--hot); border-color: var(--hot); }
.tag.warm { color: #fff; background: var(--warm); border-color: var(--warm); }
.tag.cold { color: #fff; background: var(--cold); border-color: var(--cold); }
.tag.published, .tag.booked { color: var(--good); border-color: var(--good); }
.tag.needs_human { color: var(--hot); border-color: var(--hot); }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel .stage { display: grid; grid-template-columns: 160px 1fr 60px; gap: 12px; align-items: center; font-size: 14px; }
.funnel .bar { height: 22px; background: var(--accent); border-radius: 4px; min-width: 2px; opacity: .85; }
.funnel .n { font-weight: 600; text-align: right; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi b { display: block; font-size: 26px; }
.kpi span { color: var(--muted); font-size: 13px; }
.log { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.log .bubble { max-width: 90%; font-size: 14px; }
.log .bubble.note { align-self: center; background: var(--soft); font-size: 13px; }
pre.brief { white-space: pre-wrap; font-family: inherit; background: var(--bg); padding: 12px; border-radius: 8px; border: 1px solid var(--line); }
.login { max-width: 340px; margin: 18vh auto; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; }
@media (max-width: 760px) {
  .admin { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .grow, .side .mode { display: none; }
  .content { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .funnel .stage { grid-template-columns: 110px 1fr 40px; }
  table { display: block; overflow-x: auto; }
}
