:root {
  --bg: #f6f5f1; --panel: #ffffff; --ink: #1d2320; --muted: #66706b; --line: #e3e1da;
  --brand: #0f6b4f; --brand-ink: #ffffff; --amber: #b7791f; --red: #b42318; --green: #12805c;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
nav.side { background: #12302a; color: #dfe9e4; padding: 20px 14px; }
nav.side .brand { font-weight: 700; font-size: 17px; color: #fff; margin-bottom: 4px; }
nav.side .tenant { font-size: 13px; color: #a9c2b8; margin-bottom: 22px; }
nav.side a { display: block; color: #dfe9e4; padding: 7px 10px; border-radius: 6px; }
nav.side a:hover, nav.side a.on { background: #1d4a40; text-decoration: none; color: #fff; }
nav.side form { margin-top: 24px; }
main { padding: 28px 32px; max-width: 1200px; }
h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 26px 0 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { background: #faf9f6; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eceae3; }
.badge.ai, .badge.confirmed, .badge.approved, .badge.won { background: #dcf2e8; color: var(--green); }
.badge.human, .badge.provisional, .badge.pending, .badge.quoted, .badge.booking_requested { background: #fdf0d8; color: var(--amber); }
.badge.closed, .badge.cancelled, .badge.rejected, .badge.failed, .badge.lost { background: #fde4e1; color: var(--red); }
.btn, button { white-space: nowrap; background: var(--brand); color: var(--brand-ink); border: 0; padding: 8px 14px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.btn.secondary, button.secondary { background: #e7e5de; color: var(--ink); }
.btn.danger, button.danger { background: var(--red); }
input, textarea, select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; width: 100%; background: #fff; }
textarea { min-height: 110px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; }
.inline { display: inline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 75%; padding: 9px 12px; border-radius: 12px; white-space: pre-wrap; }
.msg.customer { background: #eceae3; align-self: flex-start; }
.msg.ai { background: #dcf2e8; align-self: flex-end; }
.msg.human { background: #dbe8fb; align-self: flex-end; }
.msg .who { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
pre { background: #faf9f6; border: 1px solid var(--line); padding: 10px; border-radius: 7px; overflow: auto; font-size: 12px; max-height: 260px; }
.error { background: #fde4e1; color: var(--red); padding: 10px; border-radius: 7px; margin-bottom: 12px; }
.login { max-width: 380px; margin: 10vh auto; }
code { background: #eceae3; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; } nav.side { display: flex; flex-wrap: wrap; gap: 4px; } main { padding: 18px; } }
