/* Big Air chat dashboard. Minimal SaaS style (OpenAI Ads Manager reference):
   white, airy, left icon sidebar, underline tabs, thin-divider tables.
   Big Air orange (#ff9c00) appears only as a subtle accent. */
:root {
  --ink: #18181b; --body: #3f3f46; --muted: #71717a; --faint: #a1a1aa;
  --line: #e4e4e7; --hair: #f1f1f3; --hover: #f7f7f8; --bg: #ffffff;
  --orange: #ff9c00; --orange-soft: #fff5e6;
  --ok: #067647; --ok-bg: #ecfdf3; --warn: #b54708; --warn-bg: #fffaeb;
  --bad: #b42318; --bad-bg: #fef3f2; --blue: #175cd3; --blue-bg: #eff4ff;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange-soft); border-color: var(--orange); }
.loading { padding: 80px; text-align: center; color: var(--muted); }

/* ---------- login ---------- */
.login-wrap { max-width: 360px; margin: 14vh auto; padding: 0 20px; text-align: center; }
.login-wrap img.astro { width: 64px; height: 64px; object-fit: contain; margin-bottom: 14px; }
.login-wrap h1 { font-size: 20px; font-weight: 700; margin: 0 0 6px; letter-spacing: -0.01em; }
.login-wrap h1 span { color: var(--orange); }
.login-wrap p { color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }
.login-wrap form { display: grid; gap: 10px; text-align: left; }
.login-ok { color: var(--ok); background: var(--ok-bg); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; text-align: left; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
aside.side { width: 232px; flex: none; border-right: 1px solid var(--hair); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 9px; padding: 4px 10px 16px; }
.side-brand img { width: 30px; height: 30px; object-fit: contain; }
.side-brand .t { font-weight: 800; font-size: 15px; letter-spacing: -0.01em; }
.side-brand .t span { color: var(--orange); }
.side-park { padding: 0 6px 12px; }
.side-park select { font-size: 13px; padding: 7px 9px; border-radius: 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--body); width: 100%; text-align: left; font-weight: 500; font-size: 13.5px; }
.nav-item svg { width: 17px; height: 17px; color: var(--faint); flex: none; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--hover); color: var(--ink); font-weight: 600; }
.nav-item.active svg { color: var(--orange); }
.nav-item .badge { margin-left: auto; background: var(--orange); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.side-sep { height: 1px; background: var(--hair); margin: 10px 6px; }
.side-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 4px 10px 4px; }
.side-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--hair); }
.side-foot .who { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 6px; }
.side-foot a { font-size: 12.5px; color: var(--body); font-weight: 500; }

main.content { flex: 1; min-width: 0; padding: 26px 34px 60px; max-width: 1160px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.page-head .spacer { flex: 1; }
.page-sub { color: var(--muted); font-size: 13px; margin: -12px 0 18px; }

/* underline tabs (filters) */
.tabs-line { display: flex; gap: 22px; border-bottom: 1px solid var(--hair); margin-bottom: 18px; overflow-x: auto; }
.tabs-line button { border: 0; background: none; padding: 9px 2px 11px; color: var(--muted); font-weight: 500; font-size: 13.5px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs-line button:hover { color: var(--ink); }
.tabs-line button.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

/* buttons */
.btn { background: var(--ink); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 13.5px; }
.btn:hover { background: #2d2d31; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--hover); }
.btn.accent { background: var(--orange); }
.btn.accent:hover { filter: brightness(1.05); background: var(--orange); }
.btn.danger { background: #fff; color: var(--bad); border: 1px solid var(--line); }
.btn.danger:hover { background: var(--bad-bg); border-color: #f4c7c3; }
.btn.small { padding: 5px 11px; font-size: 12.5px; }

/* pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.open { background: var(--blue-bg); color: var(--blue); }
.pill.answered { background: var(--ok-bg); color: var(--ok); }
.pill.escalated { background: var(--warn-bg); color: var(--warn); }
.pill.lead_captured { background: var(--orange-soft); color: #b26200; }
.pill.unhandled { background: var(--bad-bg); color: var(--bad); }
.pill.handled { background: var(--ok-bg); color: var(--ok); }

/* tables - airy, thin dividers, no heavy borders */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 15px 12px; border-bottom: 1px solid var(--hair); vertical-align: top; font-size: 13.5px; color: var(--body); }
table.list td b { color: var(--ink); font-weight: 600; }
table.list tr.click:hover td { background: var(--hover); cursor: pointer; }
table.list tr.hot td { background: #fffdf7; }
.empty { padding: 56px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; font-size: 13.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { border: 1px solid var(--hair); border-radius: 12px; padding: 16px; }
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat .n em { font-style: normal; color: var(--orange); }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.panel { border: 1px solid var(--hair); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.rank-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--hair); font-size: 13.5px; }
.rank-row:last-child { border-bottom: 0; }
.rank-row b { font-weight: 600; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

/* forms */
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
label.f { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* transcript */
.transcript { display: grid; gap: 10px; max-width: 720px; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; }
.bubble.user { background: var(--ink); color: #fff; justify-self: end; border-bottom-right-radius: 4px; }
.bubble.assistant { background: var(--hover); border: 1px solid var(--hair); justify-self: start; border-bottom-left-radius: 4px; }
.bubble .meta { display: block; font-size: 11px; opacity: 0.65; margin-top: 5px; }
.lead-strip { border: 1px solid var(--hair); border-left: 3px solid var(--orange); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 13.5px; }

/* knowledge */
.kb-doc { padding: 12px 0; border-bottom: 1px solid var(--hair); }
.kb-doc:last-child { border-bottom: 0; }
.kb-doc .facts { font-size: 12px; color: var(--muted); font-family: ui-monospace, monospace; margin-top: 2px; }
.kb-doc .body { font-size: 13px; color: var(--body); white-space: pre-wrap; margin-top: 4px; }
.override-note { border: 1px solid #fde5bf; background: var(--orange-soft); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; font-size: 13.5px; }

/* mobile */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  aside.side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px; border-right: 0; border-bottom: 1px solid var(--hair); padding: 10px 12px; }
  .side-brand { padding: 0 8px 0 0; }
  .side-park { padding: 0 8px 0 0; }
  .side-park select { width: auto; }
  .nav-item { width: auto; padding: 7px 10px; }
  .nav-item svg { display: none; }
  .side-sep, .side-label { display: none; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; gap: 10px; align-items: center; }
  .side-foot .who { display: none; }
  main.content { padding: 18px 14px 50px; }
}

/* ---------- inbox (3-pane) ---------- */
.inbox { display: grid; grid-template-columns: 290px minmax(0, 1fr) 270px; border: 1px solid var(--hair); border-radius: 12px; overflow: hidden; height: calc(100vh - 210px); min-height: 480px; background: #fff; }
.ib-list { border-right: 1px solid var(--hair); overflow-y: auto; }
.ib-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 12px 14px; border-bottom: 1px solid var(--hair); cursor: pointer; }
.ib-item:hover { background: var(--hover); }
.ib-item.sel { background: var(--hover); box-shadow: inset 3px 0 0 var(--orange); }
.ib-item-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.ib-prev { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.ib-chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ib-thread { display: flex; flex-direction: column; min-width: 0; }
.ib-thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--hair); }
.ib-thread-head b { flex: 1; }
.ib-msgs { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.ib-msg { max-width: 78%; display: flex; flex-direction: column; }
.ib-msg.guest { align-self: flex-start; }
.ib-msg.assistant, .ib-msg.staff { align-self: flex-end; align-items: flex-end; }
.ib-bubble { padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.ib-msg.guest .ib-bubble { background: var(--hover); border: 1px solid var(--hair); }
.ib-msg.assistant .ib-bubble { background: #fff; border: 1px solid var(--line); }
.ib-msg.staff .ib-bubble { background: var(--orange-soft); border: 1px solid #fde5bf; }
.ib-who { font-size: 11px; color: var(--faint); margin-top: 4px; }
.ib-composer { border-top: 1px solid var(--hair); padding: 12px 14px; }
.ib-composer textarea { resize: vertical; }
.ib-rail { border-left: 1px solid var(--hair); overflow-y: auto; padding: 14px; }
.ib-rail-sec { margin-bottom: 20px; }
.ib-rail-sec h4 { margin: 0 0 10px; font-size: 13px; }
.ib-kv { display: flex; flex-direction: column; margin-bottom: 9px; font-size: 12.5px; }
.ib-kv span { color: var(--muted); }
.cp-draft { background: var(--hover); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-top: 10px; white-space: pre-wrap; }
@media (max-width: 1000px) { .inbox { grid-template-columns: 240px minmax(0, 1fr); } .ib-rail { display: none; } }
@media (max-width: 700px) { .inbox { grid-template-columns: 1fr; height: auto; } .ib-list { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--hair); } .ib-msgs { max-height: 50vh; } }

/* ---------- inbox workflow (Crisp functionality, Plain layout) ---------- */
.ib-listpane { border-right: 1px solid var(--hair); display: flex; flex-direction: column; min-height: 0; }
.ib-listhead { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--hair); font-size: 13.5px; color: var(--muted); }
.ib-listhead b { color: var(--ink); }
.ib-listhead select { width: auto; margin-left: auto; font-size: 12.5px; padding: 4px 8px; border-radius: 7px; }
.ib-item { display: flex; gap: 10px; align-items: flex-start; }
.ib-av { width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; flex: none; margin-top: 2px; }
.ib-item-body { flex: 1; min-width: 0; display: block; }
.ib-item-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.ib-ago { color: var(--faint); font-size: 12px; flex: none; }
.pill.openstate { background: var(--blue-bg); color: var(--blue); }
.pill.closed { background: #f1f1f3; color: var(--muted); }
.pill.assignee { background: #eef2ff; color: #4338ca; }
.ib-msg.noterow { align-self: stretch; max-width: 100%; align-items: flex-end; }
.ib-bubble.note { background: #fff8dd; border: 1px solid #f3e4a5; width: 100%; }
.ib-comp-tabs { display: flex; gap: 14px; margin-bottom: 8px; }
.ib-comp-tabs button { border: 0; background: none; padding: 2px 0; font-size: 12.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.ib-comp-tabs button.on { color: var(--ink); border-bottom-color: var(--orange); }
.ib-composer.notemode textarea { background: #fff8dd; border-color: #f3e4a5; }
.ib-rail-sec h4 { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin: 0 0 10px; }
.ib-kv { flex-direction: row; justify-content: space-between; gap: 10px; align-items: baseline; }
.ib-kv b { font-weight: 600; text-align: right; }
.ib-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ib-tag { border: 0; background: var(--orange-soft); color: #b26200; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.ib-tag:hover { background: #fde8c8; }
.ib-recent { display: flex; justify-content: space-between; align-items: center; width: 100%; border: 0; background: none; padding: 7px 0; border-bottom: 1px solid var(--hair); font-size: 12.5px; color: var(--body); cursor: pointer; }
.ib-recent:hover { color: var(--ink); }
.ib-search { padding: 8px 10px; border-bottom: 1px solid var(--hair); }
.ib-search input { font-size: 12.5px; padding: 7px 10px; }

/* stats bar chart (single series; #e07800 passed the palette validator, WARN
   contrast relieved by hover values + labeled max/last bars) */
.barchart { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding-top: 18px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; cursor: default; }
.bar-col .bar { width: 100%; max-width: 34px; background: #e07800; border-radius: 4px 4px 0 0; min-height: 1px; }
.bar-col:hover .bar { background: #b96300; }
.bar-col:hover::after { content: attr(data-tip); position: absolute; top: -6px; left: 50%; transform: translate(-50%, -100%); background: var(--ink); color: #fff; font-size: 11.5px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; z-index: 2; }
.bar-val { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.bar-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); border-top: 1px solid var(--hair); padding-top: 5px; margin-top: 2px; }
