:root {
  --pine: #0E6E5C; --pine-dark: #0a5446; --clay: #C8612A; --paper: #F4F6F3;
  --ink: #1c2521; --muted: #5c6b64; --line: #dfe5e0; --card: #ffffff; --ok: #2f7d5b; --bad: #b23b3b;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', system-ui, sans-serif; background: var(--paper); color: var(--ink); }
a { color: var(--pine); }
button { font: inherit; cursor: pointer; }
.btn { background: var(--pine); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600; }
.btn:hover { background: var(--pine-dark); }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.clay { background: var(--clay); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
input, textarea, select { font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; color: var(--muted); }
#login { min-height: 100vh; display: grid; place-items: center; }
#login .box { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 40px;
  max-width: 420px; text-align: center; box-shadow: 0 10px 40px rgba(14,110,92,0.08); }
.logo { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 26px; color: var(--pine); }
.logo .dot { color: var(--clay); }
#app { display: none; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: #0c2a24; color: #cfe3dc; padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; }
.side .logo { color: #fff; padding: 6px 8px 16px; font-size: 20px; }
.nav { background: none; border: 0; color: #cfe3dc; text-align: left; padding: 10px 12px; border-radius: 8px;
  width: 100%; display: flex; gap: 9px; align-items: center; text-decoration: none; }
.nav:hover { background: rgba(255,255,255,0.08); }
.nav.active { background: var(--pine); color: #fff; }
.side .spacer { flex: 1; }
.main { display: flex; flex-direction: column; min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; padding: 14px 26px; border-bottom: 1px solid var(--line); background: #fff; }
.top .who { margin-left: auto; font-size: 13px; color: var(--muted); }
.content { padding: 26px; max-width: 980px; }
h1 { font-family: 'Space Grotesk', sans-serif; font-size: 22px; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr.click:hover { background: #f7faf8; cursor: pointer; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eef3f0; color: var(--muted); }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }
.muted { color: var(--muted); }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.bad { background: var(--bad); }
.transcript .turn { margin: 12px 0; }
.transcript .who { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.transcript .bubble { padding: 10px 13px; border-radius: 10px; background: #eef3f0; display: inline-block; max-width: 80%; white-space: pre-wrap; }
.transcript .user { text-align: right; }
.transcript .user .bubble { background: var(--pine); color: #fff; }
.empty { color: var(--muted); padding: 30px; text-align: center; }
.api-path { font-family: 'Space Mono', monospace; font-size: 11px; color: var(--muted); }
.swatch { display: inline-block; width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--line); vertical-align: middle; margin-right: 6px; }

/* ---------- Responsive / mobile ---------- */
html { -webkit-text-size-adjust: 100%; }
.top #customer { max-width: 340px; }
.menu-btn { display: none; background: none; border: 0; color: var(--ink); font-size: 22px; line-height: 1; padding: 4px 8px; margin-right: 2px; }
.backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 40; }
.backdrop.show { display: block; }

/* Tablet & phone: sidebar becomes an off-canvas drawer toggled by the hamburger. */
@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 252px; max-width: 82vw; z-index: 50;
    transform: translateX(-100%); transition: transform 0.22s ease; overflow-y: auto;
    box-shadow: 2px 0 22px rgba(0,0,0,0.3);
  }
  .side.open { transform: translateX(0); }
  .nav { padding: 13px 12px; }            /* larger touch targets in the drawer */
  .menu-btn { display: inline-flex; align-items: center; }
  .top { position: sticky; top: 0; z-index: 30; padding: 11px 14px; gap: 9px; flex-wrap: wrap; }
  .top #customer { max-width: none; flex: 1 1 140px; }
  .top .who { display: none; }
  .content { padding: 16px 14px; max-width: none; }
  h1 { font-size: 20px; }
  #login .box { padding: 30px 22px; margin: 16px; }
  .transcript .bubble { max-width: 90%; }
}

/* Phone: data tables reflow into stacked key/value cards. */
@media (max-width: 620px) {
  .content table, .content thead, .content tbody, .content tr, .content td { display: block; width: 100%; }
  .content thead { position: absolute; left: -9999px; }
  .content table tr { border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; margin-bottom: 10px; }
  .content td { border: 0; padding: 8px 0; display: flex; gap: 14px; justify-content: space-between; align-items: center; text-align: right; font-size: 14px; }
  .content td::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.03em; text-align: left; white-space: nowrap; }
  .content td:not([data-label]) { justify-content: flex-end; padding-top: 4px; }
  .content td:not([data-label])::before { content: ""; }
  .content td:not([data-label]) .btn { width: 100%; text-align: center; }
  .row { flex-direction: column; gap: 0; }
  .row > * { min-width: 0; }
}
