:root {
  color-scheme: dark;
  --bg: #090a0c;
  --bg-soft: #0d0f13;
  --panel: #111318;
  --panel-2: #15181e;
  --panel-3: #1a1d23;
  --line: rgba(255, 255, 255, .1);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #f3efe8;
  --muted: #96989f;
  --muted-2: #6d7078;
  --crimson: #b9344b;
  --crimson-bright: #df405a;
  --crimson-deep: #541422;
  --amber: #d6a04a;
  --green: #32d583;
  --red: #f0445e;
  --blue: #668cff;
  --radius: 12px;
  --shadow: 0 28px 80px rgba(0, 0, 0, .42);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon, button svg, .nav-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }

/* Authentication */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 36px;
  overflow-x: hidden;
  background:
    radial-gradient(900px 520px at 16% 10%, rgba(185, 52, 75, .18), transparent 64%),
    radial-gradient(760px 480px at 92% 100%, rgba(214, 160, 74, .08), transparent 66%),
    #090a0c;
}
.auth-page::before {
  content: "";
  position: fixed;
  inset: 0;
  opacity: .28;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}
.auth-shell {
  position: relative;
  width: min(1040px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(12, 14, 18, .92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 68px;
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.auth-brand::before {
  content: "";
  position: absolute;
  width: 370px;
  height: 370px;
  right: -100px;
  top: -120px;
  border: 1px solid rgba(185, 52, 75, .3);
  border-radius: 50%;
  box-shadow: 0 0 0 55px rgba(185,52,75,.035), 0 0 0 110px rgba(185,52,75,.025);
}
.auth-brand > div:not(.signal-lines) { position: relative; z-index: 1; }
.auth-brand h1, .installer-head h1 { margin: 16px 0 14px; font-size: clamp(48px, 7vw, 76px); line-height: .92; letter-spacing: -.055em; }
.auth-copy { max-width: 460px; margin: 0; color: #a8a8ad; font-size: 17px; line-height: 1.7; }
.eyebrow { margin: 0; color: var(--amber); font-size: 10px; font-weight: 700; letter-spacing: .2em; }
.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  transform: rotate(-24deg);
}
.brand-mark span {
  position: absolute;
  width: 12px;
  height: 22px;
  border: 2px solid currentColor;
  border-left: 0;
  border-radius: 0 100% 100% 0;
}
.brand-mark span:nth-child(2) { width: 22px; height: 32px; opacity: .72; }
.brand-mark span:nth-child(3) { width: 32px; height: 42px; opacity: .4; }
.signal-lines {
  position: absolute;
  inset: auto -70px -80px 0;
  height: 300px;
  opacity: .5;
  background:
    radial-gradient(ellipse at 65% 75%, transparent 0 28%, rgba(185,52,75,.2) 28.4% 28.8%, transparent 29.2% 39%, rgba(185,52,75,.14) 39.4% 39.8%, transparent 40.2% 50%, rgba(185,52,75,.09) 50.4% 50.8%, transparent 51.2%);
}
.auth-card {
  align-self: center;
  margin: 36px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(155deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
}
.auth-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 38px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 13px rgba(50, 213, 131, .65); }
.auth-card h2 { margin: 0 0 8px; font-size: 29px; letter-spacing: -.03em; }
.auth-card > p { margin: 0 0 26px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.auth-form { display: grid; gap: 16px; }
.auth-form label, .settings-card label, .modal label { display: grid; gap: 7px; color: #b9b8ba; font-size: 11px; }
.auth-form input, .auth-form select, .settings-card input, .settings-card select, .settings-card textarea, .modal input, .modal select, .modal textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(5, 6, 8, .55);
  transition: border-color .18s, box-shadow .18s;
}
.auth-form input:focus, .auth-form select:focus, .settings-card input:focus, .settings-card select:focus, .settings-card textarea:focus, .modal input:focus, .modal select:focus, .modal textarea:focus {
  border-color: rgba(185, 52, 75, .65);
  box-shadow: 0 0 0 3px rgba(185, 52, 75, .08);
}
.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0 16px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.button svg { width: 16px; height: 16px; }
.button--primary { color: #fff; background: linear-gradient(145deg, var(--crimson-bright), #9c2038); box-shadow: 0 9px 24px rgba(185, 52, 75, .22); }
.button--primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.button--secondary { border-color: var(--line-strong); color: #d4d3d0; background: rgba(255,255,255,.035); }
.button--secondary:hover { background: rgba(255,255,255,.07); }
.button--wide { width: 100%; margin-top: 6px; }
.auth-foot { margin: 24px 0 0 !important; text-align: center; font-size: 11px !important; }
.auth-foot a { color: var(--amber); }
.alert { margin: -8px 0 18px; padding: 11px 12px; border-radius: 8px; font-size: 11px; line-height: 1.5; }
.alert--error { border: 1px solid rgba(240,68,94,.28); color: #ff9cac; background: rgba(240,68,94,.08); }
.installer-shell { position: relative; width: min(840px, 100%); }
.installer-head { display: flex; align-items: center; gap: 20px; padding: 0 32px; }
.installer-head h1 { margin: 8px 0 24px; font-size: 40px; }
.installer-card { margin: 0; padding: 36px; background: rgba(15, 17, 22, .94); box-shadow: var(--shadow); }
.installer-grid { grid-template-columns: 1fr 1fr; }
.installer-submit { grid-column: 1 / -1; }
.installer-full { grid-column: 1 / -1; }
.success-orb { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 20px; border-radius: 50%; color: var(--green); background: rgba(50,213,131,.1); font-size: 24px; }
.install-key { display: grid; gap: 7px; margin: 22px 0; }
.install-key span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.install-key code { overflow-wrap: anywhere; padding: 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--amber); background: #090a0c; }

/* Dashboard shell */
.app-page { height: 100vh; overflow: hidden; background: var(--bg); }
.command-center { height: 100vh; display: grid; grid-template-columns: 108px minmax(0, 1fr); }
.nav-rail {
  position: relative;
  z-index: 50;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0b0d10, #090a0c);
}
.brand { height: 78px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); }
.brand .brand-mark { width: 34px; height: 34px; }
.brand strong { display: none; }
.primary-nav { flex: 1; display: grid; align-content: start; gap: 7px; padding: 16px 8px; overflow: auto; }
.nav-item {
  position: relative;
  min-height: 75px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #8f9199;
  background: transparent;
  font-size: 10px;
}
.nav-item:hover { color: #ddd; background: rgba(255,255,255,.025); }
.nav-item.is-active {
  border-color: rgba(185, 52, 75, .47);
  color: #fff;
  background: linear-gradient(145deg, rgba(106,22,39,.58), rgba(68,15,28,.37));
}
.nav-item.is-active::before { content: ""; position: absolute; left: -9px; width: 2px; height: 32px; border-radius: 2px; background: var(--crimson-bright); box-shadow: 0 0 14px rgba(223,64,90,.6); }
.nav-item b {
  position: absolute; top: 8px; right: 12px; min-width: 17px; height: 17px; display: grid; place-items: center;
  border-radius: 50%; color: #fff; background: var(--crimson); font-size: 8px;
}
.nav-foot { padding: 12px 8px 16px; border-top: 1px solid var(--line); }
.operator-mini { display: none; }
.logout-button { width: 100%; border: 0; color: #696c73; background: transparent; font-size: 9px; }
.logout-button:hover { color: #ddd; }
.avatar {
  flex: 0 0 auto;
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border: 1px solid rgba(214,160,74,.32); border-radius: 50%;
  color: #f0d3b4; background: linear-gradient(145deg, rgba(214,160,74,.2), rgba(185,52,75,.22));
  font-size: 12px; font-weight: 700;
}
.app-main { min-width: 0; min-height: 0; display: grid; grid-template-rows: 78px minmax(0, 1fr); overflow: hidden; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 22px 0 26px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(600px 120px at 45% -30%, rgba(185,52,75,.12), transparent 72%),
    #0b0d10;
}
.page-heading p, .pane-head p, .visitor-panel header p, .section-heading p, .chart-card header p, .quality-card header p, .embed-card > p, .automation-guide > p {
  margin: 0 0 5px;
  color: #6c6f77;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .17em;
}
.page-heading h1 { margin: 0; font-size: 23px; letter-spacing: -.03em; }
.page-heading h1 span { display: inline-flex; align-items: center; gap: 6px; margin-left: 7px; color: #9c9fa6; font-size: 10px; font-weight: 500; letter-spacing: 0; }
.page-heading h1 span i { width: 7px; height: 7px; border-radius: 50%; background: var(--crimson-bright); box-shadow: 0 0 12px rgba(223,64,90,.7); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.presence-control, .command-button {
  height: 39px; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px; color: #c1c1c5; background: rgba(255,255,255,.025);
}
.presence-control { position: relative; padding: 0 8px 0 12px; }
.presence-control > span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px rgba(50,213,131,.55); }
.presence-control select { appearance: none; border: 0; outline: 0; padding-right: 18px; color: inherit; background: transparent; font-size: 11px; }
.presence-control option { color: var(--text); background: var(--panel); }
.presence-control svg { position: absolute; right: 7px; width: 14px; pointer-events: none; }
.command-button { padding: 0 10px; }
.command-button svg { width: 15px; }
.command-button span { font-size: 10px; }
kbd { border: 1px solid var(--line); border-bottom-color: rgba(255,255,255,.22); border-radius: 4px; padding: 1px 4px; color: #74767e; background: rgba(255,255,255,.025); font-family: inherit; font-size: 8px; }
.operator { min-width: 148px; display: grid; grid-template-columns: 38px 1fr; gap: 9px; align-items: center; padding-left: 12px; border-left: 1px solid var(--line); }
.avatar--large { width: 38px; height: 38px; }
.operator div { min-width: 0; display: grid; gap: 3px; }
.operator strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.operator small { display: flex; align-items: center; gap: 5px; color: #7d7f86; font-size: 8px; }
.operator small i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.mobile-menu { display: none; }

/* Inbox */
.view-panel { min-width: 0; min-height: 0; }
.inbox-view { display: grid; grid-template-rows: 92px minmax(0, 1fr); padding: 12px 14px 14px; overflow: hidden; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding-bottom: 12px; }
.metric-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 12px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
}
.metric-card::after { content: ""; position: absolute; inset: auto 0 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(185,52,75,.35), transparent); }
.metric-icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(185,52,75,.33); border-radius: 50%; color: var(--crimson-bright); background: rgba(185,52,75,.1); }
.metric-icon svg { width: 18px; }
.metric-card > div { min-width: 0; display: grid; gap: 1px; }
.metric-card strong { overflow: hidden; font-size: clamp(21px, 2vw, 28px); letter-spacing: -.04em; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.metric-card span:not(.metric-icon) { overflow: hidden; color: #999ba2; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.metric-card em { position: absolute; top: 10px; right: 10px; color: #555860; font-size: 6px; font-style: normal; letter-spacing: .12em; }
.metric-card--gold .metric-icon { border-color: rgba(214,160,74,.3); color: var(--amber); background: rgba(214,160,74,.08); }
.inbox-grid {
  min-width: 0; min-height: 0;
  display: grid;
  grid-template-columns: minmax(275px, 338px) minmax(360px, 1fr) minmax(260px, 310px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-soft);
}
.conversation-pane, .chat-workspace, .visitor-panel { min-width: 0; min-height: 0; }
.conversation-pane { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) 38px; border-right: 1px solid var(--line); }
.pane-head { min-height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 11px 13px 8px; }
.pane-head h2, .visitor-panel h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.pane-head h2 b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 5px; border-radius: 50%; color: #fff; background: var(--crimson); font-size: 8px; vertical-align: 2px; }
.icon-button {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 8px; color: #96989e; background: rgba(255,255,255,.02);
}
.icon-button:hover { color: #fff; border-color: var(--line-strong); background: rgba(255,255,255,.05); }
.icon-button svg { width: 17px; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) 36px; gap: 7px; padding: 0 11px 10px; }
.search-field {
  min-width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #6d7078;
  background: rgba(255,255,255,.018);
}
.search-field:focus-within { border-color: rgba(185,52,75,.45); }
.search-field svg { flex: 0 0 auto; width: 15px; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; color: #ddd; background: transparent; font-size: 10px; }
.search-field input::placeholder { color: #666870; }
.inbox-tabs { height: 38px; display: flex; align-items: flex-end; gap: 18px; padding: 0 13px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.inbox-tabs button { position: relative; height: 34px; flex: 0 0 auto; border: 0; color: #777980; background: transparent; font-size: 9px; }
.inbox-tabs button.is-active { color: #eee; }
.inbox-tabs button.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--crimson-bright); box-shadow: 0 0 8px rgba(223,64,90,.45); }
.inbox-tabs b { min-width: 16px; height: 16px; display: inline-grid; place-items: center; margin-left: 3px; border-radius: 50%; color: #92949a; background: rgba(255,255,255,.06); font-size: 7px; }
.conversation-list { min-height: 0; overflow: auto; padding: 7px; scrollbar-color: rgba(255,255,255,.12) transparent; scrollbar-width: thin; }
.conversation-card {
  position: relative;
  width: 100%;
  min-height: 91px;
  display: grid;
  grid-template-columns: 41px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  margin-bottom: 5px;
  padding: 12px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  text-align: left;
  color: inherit;
  background: transparent;
}
.conversation-card:hover { background: rgba(255,255,255,.025); }
.conversation-card.is-active { border-color: rgba(185,52,75,.48); background: linear-gradient(145deg, rgba(92,19,34,.45), rgba(52,13,24,.35)); }
.conversation-card .avatar { width: 41px; height: 41px; border-color: rgba(255,255,255,.13); color: #d6d2ce; background: rgba(255,255,255,.025); }
.conversation-card.is-active .avatar { border-color: rgba(185,52,75,.5); color: #f0b9c4; background: rgba(185,52,75,.15); }
.conversation-card__main { min-width: 0; display: grid; gap: 4px; }
.conversation-card__main strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-card__main p { display: -webkit-box; overflow: hidden; margin: 0; color: #898b92; font-size: 9px; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.conversation-card__main span { display: flex; gap: 4px; overflow: hidden; }
.mini-tag { max-width: 76px; overflow: hidden; border: 1px solid currentColor; border-radius: 4px; padding: 1px 4px; font-size: 6px; text-overflow: ellipsis; white-space: nowrap; opacity: .72; }
.conversation-card time { color: #6e7077; font-size: 7px; white-space: nowrap; }
.conversation-card__dot { position: absolute; left: 4px; top: 31px; width: 5px; height: 5px; border-radius: 50%; background: #6f7177; }
.conversation-card[data-status="waiting"] .conversation-card__dot { background: var(--amber); box-shadow: 0 0 8px rgba(214,160,74,.55); }
.conversation-card[data-status="open"] .conversation-card__dot { background: var(--green); }
.unread-badge { position: absolute; right: 9px; bottom: 8px; min-width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--crimson); font-size: 7px; }
.pane-foot { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-top: 1px solid var(--line); color: #666970; font-size: 8px; }
.pane-foot button { border: 0; color: #73757d; background: transparent; font-size: 8px; }
.list-skeleton { height: 86px; margin-bottom: 5px; border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,.02), rgba(255,255,255,.05), rgba(255,255,255,.02)); background-size: 220% 100%; animation: skeleton 1.2s infinite linear; }
@keyframes skeleton { to { background-position: -220% 0; } }
.empty-list, .loading-state { display: grid; place-items: center; min-height: 180px; color: #6d7078; font-size: 10px; text-align: center; }

/* Active chat */
.chat-workspace { position: relative; border-right: 1px solid var(--line); background: radial-gradient(500px 320px at 50% 25%, rgba(255,255,255,.018), transparent 72%); }
.empty-chat { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; text-align: center; }
.empty-chat p { margin: 24px 0 7px; color: var(--crimson-bright); font-size: 8px; font-weight: 700; letter-spacing: .18em; }
.empty-chat h2 { max-width: 350px; margin: 0 0 10px; font-size: 20px; }
.empty-chat > span { max-width: 330px; color: #73757d; font-size: 10px; line-height: 1.6; }
.empty-signal { position: relative; width: 72px; height: 72px; display: grid; place-items: center; transform: rotate(-25deg); }
.empty-signal i { position: absolute; width: 18px; height: 34px; border: 1.5px solid var(--crimson); border-left: 0; border-radius: 0 100% 100% 0; }
.empty-signal i:nth-child(2) { width: 37px; height: 52px; opacity: .55; }
.empty-signal i:nth-child(3) { width: 56px; height: 70px; opacity: .2; }
.active-chat { height: 100%; min-height: 0; display: grid; grid-template-rows: 63px minmax(0, 1fr) auto; }
.chat-top { min-width: 0; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 9px 11px; border-bottom: 1px solid var(--line); }
.avatar--visitor { width: 38px; height: 38px; border-color: rgba(185,52,75,.42); color: #efb8c2; background: rgba(185,52,75,.12); }
.chat-identity { min-width: 0; display: grid; gap: 3px; }
.chat-identity strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chat-identity > span { min-width: 0; display: flex; align-items: center; gap: 5px; overflow: hidden; color: #75777e; font-size: 7px; }
.chat-identity i { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: var(--green); }
.chat-identity b { color: #9a9ca1; font-weight: 500; }
.chat-identity em { overflow: hidden; padding-left: 5px; border-left: 1px solid var(--line); font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.chat-actions { display: flex; gap: 5px; }
.chat-actions button {
  height: 32px; min-width: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 7px; padding: 0 7px; color: #9b9da4; background: rgba(255,255,255,.02);
}
.chat-actions button:hover { color: #fff; background: rgba(255,255,255,.06); }
.chat-actions svg { width: 15px; }
.chat-actions span { font-size: 8px; }
.action-menu {
  position: absolute; z-index: 10; top: 56px; right: 10px; width: 170px; padding: 5px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: #17191e; box-shadow: 0 16px 42px rgba(0,0,0,.45);
}
.action-menu button, .action-menu a { width: 100%; display: block; border: 0; border-radius: 6px; padding: 9px; text-align: left; text-decoration: none; color: #babac0; background: transparent; font-size: 9px; }
.action-menu button:hover, .action-menu a:hover { color: #fff; background: rgba(255,255,255,.05); }
.action-menu .danger { color: #f27c8f; }
.message-list { min-height: 0; overflow: auto; padding: 17px 18px 12px; scrollbar-color: rgba(255,255,255,.13) transparent; scrollbar-width: thin; }
.chat-message { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 13px; animation: message-enter .18s ease; }
@keyframes message-enter { from { opacity: 0; transform: translateY(5px); } }
.chat-message--agent { align-items: flex-end; }
.chat-message--note { align-items: center; }
.chat-message__bubble { max-width: 78%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 5px 11px 11px 11px; color: #dedddd; background: #181b20; font-size: 10px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message--agent .chat-message__bubble { border-color: rgba(185,52,75,.43); border-radius: 11px 5px 11px 11px; background: linear-gradient(145deg, rgba(105,23,40,.8), rgba(65,15,28,.88)); }
.chat-message--bot .chat-message__bubble { border-color: rgba(214,160,74,.22); background: rgba(214,160,74,.06); }
.chat-message--note .chat-message__bubble { max-width: 92%; border-color: rgba(214,160,74,.25); color: #c9ad7b; background: rgba(214,160,74,.055); font-size: 9px; font-style: italic; }
.chat-message__meta { margin: 4px 3px 0; color: #666970; font-size: 7px; }
.message-divider { display: flex; align-items: center; gap: 8px; margin: 0 0 15px; color: #5f626a; font-size: 7px; }
.message-divider::before, .message-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.reply-composer { margin: 0 9px 9px; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(7,8,10,.72); }
.reply-composer.is-note { border-color: rgba(214,160,74,.36); background: rgba(214,160,74,.035); }
.composer-mode { height: 31px; display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.composer-mode button { height: 23px; border: 0; border-radius: 5px; padding: 0 8px; color: #6e7078; background: transparent; font-size: 7px; }
.composer-mode button.is-active { color: #e5e1dd; background: rgba(185,52,75,.18); }
.composer-mode span { margin-left: auto; color: #555860; font-size: 7px; }
.reply-composer textarea { width: 100%; min-height: 55px; max-height: 126px; display: block; resize: vertical; border: 0; outline: 0; padding: 10px 11px 4px; color: #e9e6e1; background: transparent; font-size: 10px; line-height: 1.5; }
.reply-composer textarea::placeholder { color: #585b63; }
.reply-tools { min-height: 37px; display: flex; align-items: center; justify-content: space-between; padding: 4px 5px 5px 8px; }
.reply-tools > div { display: flex; gap: 3px; }
.reply-tools > div button { width: 27px; height: 27px; display: grid; place-items: center; border: 0; border-radius: 5px; color: #71747b; background: transparent; }
.reply-tools > div button:hover { color: #ddd; background: rgba(255,255,255,.05); }
.reply-tools > div svg { width: 14px; }
.reply-button { height: 30px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 6px; padding: 0 12px; color: #fff; background: linear-gradient(145deg, var(--crimson-bright), #a5223b); font-size: 8px; font-weight: 700; box-shadow: 0 6px 16px rgba(185,52,75,.22); }
.reply-button svg { width: 13px; }
.reply-button:disabled { opacity: .45; cursor: wait; }
.reply-suggestions { position: absolute; z-index: 8; left: 14px; right: 14px; bottom: 114px; max-height: 210px; overflow: auto; padding: 5px; border: 1px solid var(--line-strong); border-radius: 9px; background: #17191f; box-shadow: 0 15px 40px rgba(0,0,0,.48); }
.suggestion { width: 100%; display: grid; grid-template-columns: 70px 1fr; gap: 8px; border: 0; border-radius: 6px; padding: 8px; text-align: left; color: #a9abb1; background: transparent; font-size: 8px; }
.suggestion:hover { color: #fff; background: rgba(255,255,255,.05); }
.suggestion b { color: var(--amber); }
.mobile-back { display: none; }

/* Visitor context */
.visitor-panel { overflow: auto; background: #0d0f12; scrollbar-color: rgba(255,255,255,.12) transparent; scrollbar-width: thin; }
.context-empty { height: 100%; display: grid; place-content: center; gap: 10px; padding: 25px; color: #60636a; text-align: center; font-size: 9px; line-height: 1.5; }
.context-empty svg { width: 28px; height: 28px; margin: auto; }
.visitor-panel header { height: 61px; display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.visitor-panel header button { display: none; border: 0; color: #999; background: transparent; font-size: 21px; }
.visitor-profile { display: grid; justify-items: center; padding: 15px 12px 13px; border-bottom: 1px solid var(--line); }
.avatar--profile { width: 48px; height: 48px; margin-bottom: 8px; font-size: 15px; }
.visitor-profile strong { font-size: 11px; }
.visitor-profile a { margin-top: 3px; color: #777a81; font-size: 8px; text-decoration: none; }
.intel-card, .session-card { margin: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.015); }
.intel-card > div { min-height: 47px; display: grid; align-content: center; gap: 3px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.intel-card > div:last-child { border-bottom: 0; }
.intel-card span, .page-card span, .session-card span { color: #70737a; font-size: 7px; }
.intel-card strong { overflow: hidden; color: #bdbdc1; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.page-card { margin: 10px; display: grid; gap: 5px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.015); }
.page-card a { overflow: hidden; color: var(--crimson-bright); font-size: 8px; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.session-card { padding: 8px 10px; }
.session-card h3 { margin: 2px 0 7px; color: #a1a2a7; font-size: 9px; }
.session-card > div { min-height: 31px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); }
.session-card strong { max-width: 58%; overflow: hidden; color: #a5a6aa; font-size: 8px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.context-controls { display: grid; gap: 6px; padding: 0 10px 12px; }
.context-controls button { min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 7px; color: #a2a4a9; background: rgba(255,255,255,.02); font-size: 8px; }
.context-controls button:hover { color: #fff; background: rgba(255,255,255,.05); }
.context-controls button.danger { border-color: rgba(240,68,94,.2); color: #de7787; }
.context-controls svg { width: 13px; }

/* Secondary views */
.data-view { height: 100%; padding: 20px; overflow: auto; }
.section-heading { min-height: 70px; display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin: 0 0 5px; font-size: 25px; letter-spacing: -.035em; }
.section-heading > div > span { color: #787a82; font-size: 10px; }
.section-search { width: min(280px, 100%); }
.data-card { border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(145deg, rgba(255,255,255,.028), rgba(255,255,255,.01)); }
.responsive-table { overflow-x: auto; }
.responsive-table table { width: 100%; border-collapse: collapse; font-size: 9px; }
.responsive-table th { padding: 12px; border-bottom: 1px solid var(--line); color: #62656d; text-align: left; font-size: 7px; text-transform: uppercase; letter-spacing: .12em; white-space: nowrap; }
.responsive-table td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,.055); color: #a9aab0; white-space: nowrap; }
.responsive-table tr:last-child td { border-bottom: 0; }
.responsive-table tbody tr:hover { background: rgba(255,255,255,.018); }
.table-identity { display: flex; align-items: center; gap: 8px; }
.table-identity .avatar { width: 29px; height: 29px; font-size: 9px; }
.table-identity div { display: grid; gap: 2px; }
.table-identity strong { color: #d8d6d2; font-size: 9px; }
.table-identity span { color: #686b73; font-size: 7px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 99px; padding: 4px 7px; color: #92949a; font-size: 7px; }
.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #777; }
.status-pill--online { color: #71dda8; border-color: rgba(50,213,131,.19); background: rgba(50,213,131,.05); }
.status-pill--online::before { background: var(--green); }
.status-pill--waiting { color: #dfb76f; border-color: rgba(214,160,74,.2); background: rgba(214,160,74,.05); }
.status-pill--waiting::before { background: var(--amber); }
.status-pill--closed::before { background: #73767e; }
.table-link { border: 0; color: var(--crimson-bright); background: transparent; font-size: 8px; }
.range-pill { border: 1px solid var(--line); border-radius: 99px; padding: 7px 10px; color: #81838b; font-size: 8px; }
.analytics-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.analytics-summary article { padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.02); }
.analytics-summary span { display: block; margin-bottom: 9px; color: #6c6f77; font-size: 7px; text-transform: uppercase; letter-spacing: .13em; }
.analytics-summary strong { font-size: 23px; letter-spacing: -.04em; }
.analytics-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(240px, .8fr); gap: 12px; }
.chart-card, .quality-card { min-height: 360px; padding: 16px; }
.chart-card header, .quality-card header { display: flex; justify-content: space-between; align-items: start; }
.chart-card h3, .quality-card h3, .embed-card h3, .automation-guide h3 { margin: 0; font-size: 16px; }
.chart-card header > span { color: #656870; font-size: 8px; }
.bar-chart { height: 265px; display: flex; align-items: end; gap: 7px; margin-top: 24px; padding-top: 20px; border-bottom: 1px solid var(--line); }
.bar-column { min-width: 0; height: 100%; flex: 1; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 7px; }
.bar-column i { width: min(18px, 75%); min-height: 3px; border-radius: 4px 4px 0 0; background: linear-gradient(to top, #6d182b, var(--crimson-bright)); box-shadow: 0 0 13px rgba(185,52,75,.12); }
.bar-column span { color: #62656d; font-size: 6px; }
.bar-column em { color: #898b92; font-size: 7px; font-style: normal; }
.quality-card header { display: block; }
#quality-metrics { display: grid; gap: 10px; margin-top: 24px; }
.quality-row { display: grid; gap: 7px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.quality-row div { display: flex; justify-content: space-between; color: #85878e; font-size: 8px; }
.quality-row strong { color: #d4d1cc; }
.quality-meter { height: 4px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.055); }
.quality-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--crimson), var(--amber)); }
.automation-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 12px; }
.automation-list { display: grid; align-content: start; gap: 8px; }
.automation-card { min-height: 86px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.018); }
.automation-card__icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(214,160,74,.23); border-radius: 10px; color: var(--amber); background: rgba(214,160,74,.06); }
.automation-card__icon svg { width: 18px; }
.automation-card__main { min-width: 0; display: grid; gap: 4px; }
.automation-card__main strong { font-size: 10px; }
.automation-card__main span { overflow: hidden; color: #70727a; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.automation-actions { display: flex; align-items: center; gap: 7px; }
.toggle { position: relative; width: 34px; height: 19px; border: 0; border-radius: 99px; background: #2d3036; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 13px; height: 13px; border-radius: 50%; background: #797c83; transition: .18s; }
.toggle.is-on { background: rgba(185,52,75,.55); }
.toggle.is-on::after { left: 18px; background: #fff; }
.delete-automation { width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 6px; color: #777a81; background: transparent; }
.delete-automation:hover { color: #f27c8f; border-color: rgba(240,68,94,.25); }
.automation-guide { padding: 18px; }
.automation-guide ul { display: grid; gap: 11px; margin: 20px 0 0; padding: 0; list-style: none; }
.automation-guide li { position: relative; padding-left: 17px; color: #86888f; font-size: 9px; }
.automation-guide li::before { content: "✓"; position: absolute; left: 0; color: var(--amber); }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 12px; }
.settings-card { display: grid; gap: 15px; padding: 18px; }
.settings-card textarea { resize: vertical; }
.settings-card small, .modal label small { color: #656870; font-size: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.settings-card input[type="color"] { height: 46px; padding: 5px; }
.checkbox-control {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  background: rgba(5, 6, 8, .55);
}
.settings-card .checkbox-control input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--crimson-bright);
}
.checkbox-control b { color: #aaa9ac; font-size: 9px; font-weight: 500; }
.embed-card { align-self: start; padding: 20px; }
.embed-card > span { display: block; margin: 8px 0 14px; color: #777980; font-size: 9px; line-height: 1.6; }
.embed-card pre { min-height: 105px; margin: 0 0 10px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 12px; color: #c5949d; background: #090a0c; font-size: 8px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.security-note { display: grid; gap: 3px; margin-top: 16px; padding: 12px; border: 1px solid rgba(50,213,131,.15); border-radius: 8px; background: rgba(50,213,131,.035); }
.security-note strong { color: #74dba9; font-size: 9px; }
.security-note span { color: #6f8278; font-size: 8px; }
.dedicated-card {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(214,160,74,.2);
  border-radius: 9px;
  background: rgba(214,160,74,.045);
}
.dedicated-card > p { margin: 0; color: var(--amber); font-size: 8px; font-weight: 700; letter-spacing: .15em; }
.dedicated-card > strong { font-size: 11px; }
.dedicated-card > a:not(.button) { color: #dbb675; font-size: 9px; line-height: 1.5; overflow-wrap: anywhere; }
.dedicated-card > div { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.dedicated-card .button { min-height: 36px; padding: 0 9px; font-size: 9px; }
.dedicated-card > small { color: #777a82; font-size: 8px; }
.button.is-disabled, .button:disabled { opacity: .45; pointer-events: none; }
.settings-update-link { width: 100%; margin-top: 14px; }

/* Modal, toast, mobile */
.modal {
  width: min(560px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 0;
  color: var(--text);
  background: #121419;
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(4px); }
.modal form { display: grid; gap: 13px; padding: 20px; }
.modal header { display: flex; align-items: start; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.modal header p { margin: 0 0 5px; color: var(--amber); font-size: 8px; letter-spacing: .15em; }
.modal header h2 { margin: 0; font-size: 20px; }
.modal header button { border: 0; color: #888; background: transparent; font-size: 22px; }
.modal textarea { resize: vertical; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 7px; }
.toast {
  position: fixed; z-index: 200; left: 50%; bottom: 22px; max-width: min(420px, calc(100% - 30px));
  padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 9px; color: #ddd;
  background: #202228; box-shadow: 0 14px 40px rgba(0,0,0,.45); font-size: 10px;
  opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition: .18s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: rgba(240,68,94,.28); color: #ff9bac; background: #2b171c; }
.mobile-nav, .mobile-overlay { display: none; }

@media (min-width: 1600px) {
  .command-center { grid-template-columns: 116px minmax(0, 1fr); }
  .inbox-grid { grid-template-columns: 370px minmax(440px, 1fr) 340px; }
  .conversation-card { min-height: 98px; }
}

@media (max-width: 1180px) {
  .inbox-grid { grid-template-columns: 300px minmax(360px, 1fr); }
  .visitor-panel {
    position: absolute; z-index: 25; top: 78px; right: 14px; bottom: 14px; width: min(320px, calc(100% - 28px));
    border: 1px solid var(--line-strong); border-radius: 11px; box-shadow: var(--shadow);
    transform: translateX(calc(100% + 30px)); transition: transform .22s ease;
  }
  .visitor-panel.is-open { transform: none; }
  .visitor-panel header button { display: block; }
  .metric-grid { grid-template-columns: repeat(4, minmax(150px, 1fr)); overflow-x: auto; scrollbar-width: none; }
  .metric-card { min-width: 170px; }
}

@media (max-width: 860px) {
  .app-page { overflow: auto; }
  .command-center { min-height: 100dvh; height: auto; display: block; }
  .nav-rail {
    position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: 20px 0 60px rgba(0,0,0,.5);
  }
  .nav-rail.is-open { transform: none; }
  .brand { justify-content: flex-start; gap: 12px; padding: 0 20px; }
  .brand strong { display: block; font-size: 17px; }
  .primary-nav { display: block; padding: 12px; }
  .nav-item { width: 100%; min-height: 48px; flex-direction: row; justify-content: flex-start; padding: 0 14px; margin-bottom: 5px; font-size: 11px; }
  .nav-item.is-active::before { left: -12px; }
  .nav-item b { top: 15px; right: 14px; }
  .nav-foot { padding: 12px 14px 22px; }
  .operator-mini { display: grid; grid-template-columns: 36px 1fr; gap: 9px; align-items: center; margin-bottom: 12px; }
  .operator-mini div { display: grid; gap: 3px; }
  .operator-mini strong { font-size: 10px; }
  .operator-mini small { color: #70727a; font-size: 8px; }
  .logout-button { min-height: 35px; border: 1px solid var(--line); border-radius: 7px; }
  .app-main { min-height: 100dvh; height: auto; display: block; overflow: visible; padding-bottom: 66px; }
  .topbar { position: sticky; z-index: 20; top: 0; height: 68px; padding: 0 14px; }
  .mobile-menu { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: #aaa; background: rgba(255,255,255,.02); }
  .page-heading { flex: 1; }
  .page-heading p { display: none; }
  .page-heading h1 { font-size: 18px; }
  .topbar-actions { gap: 7px; }
  .command-button, .operator { display: none; }
  .inbox-view { min-height: calc(100dvh - 134px); display: block; padding: 10px; overflow: visible; }
  .metric-grid { height: 78px; padding-bottom: 10px; }
  .metric-card { min-width: 158px; }
  .inbox-grid { height: calc(100dvh - 224px); min-height: 500px; grid-template-columns: 310px minmax(0, 1fr); }
  .visitor-panel { top: 68px; bottom: 64px; }
  .data-view { min-height: calc(100dvh - 134px); height: auto; padding: 15px 12px; }
  .analytics-summary { grid-template-columns: repeat(2, 1fr); }
  .analytics-grid, .settings-grid, .automation-layout { grid-template-columns: 1fr; }
  .automation-guide { order: -1; }
  .mobile-nav {
    position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; height: 64px;
    display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line); background: rgba(10,11,14,.96); backdrop-filter: blur(15px);
  }
  .mobile-nav button { display: grid; place-items: center; align-content: center; gap: 4px; border: 0; color: #6d7078; background: transparent; font-size: 8px; }
  .mobile-nav button svg { width: 18px; }
  .mobile-nav button.is-active { color: var(--crimson-bright); }
  .mobile-overlay { position: fixed; z-index: 40; inset: 0; background: rgba(0,0,0,.65); }
  .mobile-overlay.is-open { display: block; }
}

@media (max-width: 640px) {
  .auth-page { padding: 14px; }
  .auth-shell { min-height: 0; display: block; }
  .auth-brand { min-height: 210px; padding: 35px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-brand h1 { font-size: 46px; }
  .auth-copy { font-size: 13px; }
  .auth-card { margin: 14px; padding: 24px; }
  .installer-head { padding: 0 10px; }
  .installer-grid, .form-grid { grid-template-columns: 1fr; }
  .inbox-grid { display: block; height: calc(100dvh - 224px); min-height: 480px; }
  .conversation-pane { height: 100%; border-right: 0; }
  .chat-workspace { position: absolute; z-index: 12; inset: 0; border-right: 0; background: #0c0e12; transform: translateX(100%); transition: transform .22s ease; }
  .chat-workspace.is-open { transform: none; }
  .mobile-back { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: #aaa; background: transparent; }
  .chat-top { grid-template-columns: 29px 35px minmax(0, 1fr) auto; }
  .chat-top .avatar { width: 35px; height: 35px; }
  .chat-actions span { display: none; }
  .chat-actions button:first-child { min-width: 32px; }
  .visitor-panel { position: fixed; z-index: 60; inset: 0; width: 100%; border: 0; border-radius: 0; transform: translateX(100%); }
  .visitor-panel.is-open { transform: none; }
  .section-heading { display: grid; min-height: 100px; }
  .section-heading .button, .section-search { width: 100%; }
  .analytics-summary { grid-template-columns: 1fr 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .chart-card, .quality-card { min-height: 320px; }
  .responsive-table table { min-width: 700px; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
