/* Voz AI Inbox. Brand: Night #070A0F, Ink #0B1220, Deep Teal #00A080, Signal Teal #10CFA8, Live Orange #FF6A30, Slate #5B6B82 */
:root {
  --night: #070A0F; --ink: #0B1220; --teal: #00A080; --teal-bright: #10CFA8; --orange: #FF6A30;
  --slate: #5B6B82; --line: #E3E8EF; --bg: #F4F6F9; --card: #FFFFFF; --bad: #C2410C; --warn-bg: #FFF1E8;
  --good-bg: #E3F7F1; --bot-bg: #E3F7F1; --human-bg: #0B1220; --user-bg: #FFFFFF;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; display: flex; flex-direction: column; font-size: 15px; line-height: 1.45; }
a { color: var(--teal); }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 0; }
.muted { color: var(--slate); }
.small { font-size: 12px; }
.bad { color: var(--bad); }
.empty { color: var(--slate); padding: 24px; text-align: center; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 56px; background: var(--night); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand span { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: #8C9AB0; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: #C9D2DF; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.topbar nav a.on, .topbar nav a:hover { background: #151C28; color: #fff; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #C9D2DF; margin: 0; }
button.link { background: none; border: 0; color: var(--teal-bright); cursor: pointer; font: inherit; padding: 0; }

/* buttons & forms */
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 16px; }
button.primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
button.primary:hover { background: #008A6E; }
button.small { padding: 5px 10px; font-size: 13px; }
button.wide { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ig { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: #fff; border: 0;
  background: linear-gradient(45deg, #F58529, #DD2A7B 45%, #8134AF 75%, #515BD4); padding: 11px 18px; }
label { display: block; font-size: 13px; color: var(--slate); margin: 12px 0; }
label input, label select { display: block; width: 100%; margin-top: 4px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0 12px 0 0; }
label.inline select { width: auto; margin: 0; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--teal-bright); outline-offset: 0; border-color: transparent; }

.note { padding: 10px 14px; border-radius: 8px; background: #EEF2F7; margin: 10px 0; font-size: 14px; }
.note.ok { background: var(--good-bg); }
.note.err { background: var(--warn-bg); color: var(--bad); }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #EEF2F7; color: var(--slate); white-space: nowrap; }
.tag.good { background: var(--good-bg); color: #007A62; }
.tag.warn { background: var(--warn-bg); color: var(--bad); }
.tag.acct { background: transparent; border: 1px solid var(--line); }

/* auth pages */
body.auth main { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.authcard { width: 100%; max-width: 380px; background: var(--card); border-radius: var(--radius); padding: 32px 28px; box-shadow: 0 8px 30px rgba(11,18,32,.08); }
.authcard h1 { margin-top: 18px; }

/* inbox split view */
body.app main { flex: 1; display: flex; min-height: 0; }
.split { flex: 1; display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 56px); }
.list { background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; }
.conv { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.conv:hover { background: #F8FAFC; }
.conv.active { background: #EAF6F2; box-shadow: inset 3px 0 0 var(--teal); }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, var(--teal), #0B6B5A); }
.cbody { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.crow { display: flex; justify-content: space-between; gap: 8px; }
.crow b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow time { font-size: 12px; color: var(--slate); flex: none; }
.snippet { font-size: 13px; color: var(--slate); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }

.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.placeholder { margin: auto; text-align: center; color: var(--slate); }
.phead { display: flex; align-items: center; gap: 14px; padding: 14px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.phead > div { flex: 1; min-width: 0; }
.phead p { margin: 2px 0 0; font-size: 13px; }
.back { display: none; font-size: 28px; text-decoration: none; color: var(--ink); line-height: 1; }
.botswitch { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.on { background: var(--teal-bright); box-shadow: 0 0 0 3px rgba(16,207,168,.2); }
.dot.off { background: #B6C0CE; }
.pane > .note { margin: 8px 20px 0; padding: 6px 12px; font-size: 13px; }
.leadcard { margin: 8px 20px 0; padding: 7px 12px; border-radius: 8px; background: var(--good-bg); display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; }

.thread { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; flex-direction: column; max-width: 72%; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.msg.in .bubble { background: var(--user-bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.bot .bubble { background: var(--bot-bg); border-bottom-right-radius: 4px; }
.msg.human .bubble, .msg.ig_app .bubble { background: var(--human-bg); color: #fff; border-bottom-right-radius: 4px; }
.msg.failed .bubble { opacity: .55; text-decoration: line-through; }
.meta { font-size: 11px; color: var(--slate); margin-top: 3px; padding: 0 4px; }
.att { font-style: italic; color: var(--slate); }

.composer { background: var(--card); border-top: 1px solid var(--line); padding: 10px 20px 14px; margin: 0; }
.composer .row { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { flex: 1; resize: vertical; min-height: 44px; }
.window { margin: 0 0 8px; font-size: 12px; color: #007A62; }
.window.blocked { color: var(--bad); }
.window.human_agent { color: #B45309; }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--slate); }

/* table pages */
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 28px 20px; }
.connect { display: flex; gap: 24px; align-items: center; justify-content: space-between; background: var(--card);
  border-radius: var(--radius); padding: 20px 22px; margin: 18px 0 22px; border: 1px solid var(--line); }
.connect p { margin: 6px 0 0; font-size: 14px; max-width: 560px; }
.connect form { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0; }
.grid { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); margin-top: 14px; }
.grid th, .grid td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
.grid th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate); background: #F8FAFC; }
.grid tr:last-child td { border-bottom: 0; }
.grid form { margin: 0; }
.foot { text-align: center; font-size: 12px; color: var(--slate); padding: 18px; }
.foot a { color: var(--slate); }

@media (max-width: 760px) {
  .topbar { gap: 10px; padding: 0 12px; overflow-x: auto; }
  .brand span, .who span { display: none; }
  .topbar nav a { padding: 6px; font-size: 12px; }
  .brand img { height: 18px; }
  .split { grid-template-columns: 1fr; }
  .split.has-conv .list { display: none; }
  .split:not(.has-conv) .pane { display: none; }
  .back { display: block; }
  .msg { max-width: 88%; }
  .phead { flex-wrap: wrap; padding: 12px 16px; }
  .connect { flex-direction: column; align-items: stretch; }
  .grid { display: block; overflow-x: auto; }
  .page { padding: 20px 16px; }
}
