:root {
  color-scheme: light;
  --ink: #13213c;
  --muted: #5f6b80;
  --brand: #3558d4;
  --brand-dark: #263f9f;
  --accent: #7be0cf;
  --surface: #ffffff;
  --surface-soft: #f3f6fb;
  --line: #dce3ef;
  --shadow: 0 24px 60px rgba(31, 52, 110, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-size: 16px;
  line-height: 1.65;
}

a {
  color: var(--brand-dark);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--brand);
}

a:focus-visible {
  outline: 3px solid rgba(53, 88, 212, 0.3);
  outline-offset: 4px;
  border-radius: 4px;
}

.container {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid rgba(220, 227, 239, 0.75);
  background: rgba(255, 255, 255, 0.9);
}

.nav {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 760;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, var(--brand), #6e83e8);
  box-shadow: 0 8px 20px rgba(53, 88, 212, 0.25);
}

.brand-mark::before {
  content: "N";
  font-size: 17px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 14px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--ink);
}

.nav-links .nav-action { padding: 8px 12px; border: 1px solid #d8deea; border-radius: 9px; }
.nav-links .nav-action.primary { color: #fff; border-color: #3558d4; background: #3558d4; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero-button { display: inline-flex; min-height: 44px; align-items: center; padding: 10px 16px; border-radius: 10px; color: #fff; background: #3558d4; font-weight: 700; text-decoration: none; }
.hero-button.secondary { color: #263654; border: 1px solid #ccd5e4; background: #fff; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 96px 0 112px;
  background:
    radial-gradient(circle at 80% 20%, rgba(123, 224, 207, 0.28), transparent 28%),
    radial-gradient(circle at 12% 90%, rgba(97, 123, 224, 0.18), transparent 30%),
    linear-gradient(180deg, #f9fbff 0%, #ffffff 100%);
}

.hero::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  right: -180px;
  bottom: -210px;
  border: 1px solid rgba(53, 88, 212, 0.16);
  border-radius: 50%;
  box-shadow: 0 0 0 56px rgba(53, 88, 212, 0.035), 0 0 0 112px rgba(53, 88, 212, 0.025);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  padding: 7px 12px;
  border: 1px solid rgba(53, 88, 212, 0.16);
  border-radius: 999px;
  color: var(--brand-dark);
  background: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 680;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(123, 224, 207, 0.2);
}

.hero h1 {
  max-width: 880px;
  margin: 0;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 1.04;
  letter-spacing: -0.052em;
}

.hero .lead {
  max-width: 750px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(19px, 2.2vw, 24px);
  line-height: 1.55;
}

.ownership-note {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin-top: 30px;
  padding: 16px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 0 14px 14px 0;
  color: var(--muted);
  background: rgba(243, 246, 251, 0.8);
}

.ownership-note strong {
  color: var(--ink);
}

.integration-card {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin-top: 24px;
  padding: 22px 24px;
  border: 1px solid rgba(220, 227, 239, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.integration-card strong {
  color: var(--brand-dark);
}

.section {
  padding: 88px 0;
}

.section-soft {
  background: var(--surface-soft);
}

.section h2 {
  margin: 0 0 18px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.section-intro {
  max-width: 690px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 38px;
}

.feature {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.feature h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.feature p {
  margin: 0;
  color: var(--muted);
}

.legal-main {
  padding: 58px 0 96px;
  background: linear-gradient(180deg, #f8faff 0, #fff 260px);
}

.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(180px, 1fr);
  align-items: start;
  gap: 64px;
}

.legal-kicker {
  margin: 0 0 8px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legal-content h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.effective-date {
  margin: 16px 0 42px;
  color: var(--muted);
}

.legal-content h2 {
  margin: 42px 0 14px;
  padding-top: 8px;
  font-size: 23px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.legal-content h3 {
  margin: 26px 0 8px;
  font-size: 18px;
}

.legal-content p,
.legal-content li {
  color: #344159;
}

.legal-content ul,
.legal-content ol {
  padding-left: 24px;
}

.legal-content li + li {
  margin-top: 7px;
}

.legal-note {
  margin: 28px 0;
  padding: 20px 22px;
  border-left: 4px solid var(--brand);
  border-radius: 0 12px 12px 0;
  background: var(--surface-soft);
}

.legal-nav {
  position: sticky;
  top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  font-size: 14px;
}

.legal-nav strong {
  display: block;
  margin-bottom: 10px;
}

.legal-nav a {
  display: block;
  padding: 5px 0;
  color: var(--muted);
  text-decoration: none;
}

.site-footer {
  padding: 34px 0;
  border-top: 1px solid var(--line);
  background: #fff;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  color: var(--muted);
  font-size: 14px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

@media (max-width: 820px) {
  .nav {
    min-height: 66px;
  }

  .nav-links {
    display: none;
  }

  .hero {
    padding: 70px 0 84px;
  }

  .feature-grid,
  .legal-layout {
    grid-template-columns: 1fr;
  }

  .legal-layout {
    gap: 36px;
  }

  .legal-nav {
    position: static;
    order: -1;
  }
}

@media (max-width: 560px) {
  .container {
    width: min(100% - 28px, 1120px);
  }

  .hero {
    padding: 56px 0 70px;
  }

  .integration-card {
    padding: 18px;
  }

  .section {
    padding: 66px 0;
  }

  .feature-grid {
    gap: 14px;
  }

  .legal-main {
    padding: 42px 0 72px;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Authenticated chats application */
.app-body {
  min-height: 100vh;
  overflow: hidden;
  background: #eef2f8;
  line-height: 1.45;
}

.app-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.app-nav { display: flex; align-items: center; gap: 20px; font-size: 14px; }
.app-nav a, .button-link { color: var(--muted); text-decoration: none; }
.app-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(53, 88, 212, .25); outline-offset: 2px; }

.button-link, .icon-button {
  padding: 6px;
  border: 0;
  background: transparent;
}

.auth-card, .card {
  width: min(520px, calc(100% - 32px));
  margin: 64px auto;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-card h1, .card h1 { margin: 0 0 10px; line-height: 1.15; }
.muted { color: var(--muted); }
.stack-form { display: grid; gap: 18px; margin-top: 26px; }
.stack-form label, .card label { display: grid; gap: 7px; color: #344159; font-size: 14px; font-weight: 650; }
.stack-form input, .card input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #bdc8da;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}
.stack-form button, .card button:not(.button-link), .actions button {
  padding: 11px 16px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
}
.form-status { min-height: 24px; color: var(--muted); }

.chats-shell {
  height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(380px, 1fr) minmax(260px, 310px);
  gap: 1px;
  background: var(--line);
}

.chat-list-pane, .conversation-pane, .context-pane { min-width: 0; background: #fff; }
.chat-list-pane, .context-pane { overflow-y: auto; }
.pane-heading { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 12px; }
.pane-heading h1 { margin: 1px 0 0; font-size: 25px; }
.kicker { margin: 0; color: var(--brand); font-size: 12px; font-weight: 760; letter-spacing: .09em; text-transform: uppercase; }
.icon-button { width: 38px; height: 38px; border-radius: 10px; color: var(--brand-dark); background: var(--surface-soft); font-size: 20px; }
.inbox-search { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 6px; padding: 4px 20px 10px; }
.inbox-search input, .inbox-filter-panel select, .context-control select { min-width: 0; padding: 8px 9px; border: 1px solid #bdc8da; border-radius: 9px; color: var(--ink); background: #fff; font: inherit; }
.inbox-search button { padding: 8px 10px; border: 0; border-radius: 9px; color: #fff; background: var(--brand); font-weight: 700; }
.inbox-search .search-clear { color: var(--muted); background: var(--surface-soft); font-size: 18px; line-height: 1; }
.inbox-queues { display: flex; gap: 6px; padding: 2px 20px 10px; overflow-x: auto; scrollbar-width: thin; }
.inbox-queues button { flex: 0 0 auto; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-size: 12px; white-space: nowrap; }
.inbox-queues button[aria-pressed="true"] { border-color: rgba(53, 88, 212, .28); color: var(--brand-dark); background: #edf1ff; }
.inbox-queues [data-queue-count]:not(:empty) { margin-left: 3px; font-variant-numeric: tabular-nums; }
.filter-toolbar { display: flex; align-items: center; gap: 10px; padding: 0 20px 8px; }
.filter-toolbar .secondary-button { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.filter-clear { padding: 5px; border: 0; color: var(--brand-dark); background: transparent; font-size: 11px; }
#active-filter-count { display: inline-grid; min-width: 18px; min-height: 18px; place-items: center; margin-left: 4px; border-radius: 999px; color: #fff; background: var(--brand); font-size: 10px; }
.active-filter-summary { display: flex; min-height: 0; gap: 5px; padding: 0 20px 7px; overflow-x: auto; color: var(--muted); font-size: 10px; }
.active-filter-summary:empty { display: none; }
.filter-chip { flex: 0 0 auto; padding: 4px 7px; border-radius: 999px; background: var(--surface-soft); white-space: nowrap; }
.inbox-filter-panel { display: grid; gap: 10px; margin: 0 12px 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 12px 30px rgba(31,52,110,.12); }
.inbox-filter-panel label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.filter-panel-heading { display: flex; align-items: center; justify-content: space-between; color: var(--ink); font-size: 13px; }
.filter-panel-heading button { width: 30px; height: 30px; border: 0; border-radius: 8px; color: var(--muted); background: var(--surface-soft); font-size: 19px; }
.outside-results { margin: 0 0 8px; padding: 6px 8px; border-radius: 8px; color: #765614; background: #fff5d8; font-size: 11px; }
.pane-status { min-height: 22px; margin: 0; padding: 0 20px; color: var(--muted); font-size: 13px; }
.chat-list { padding: 4px 10px 18px; }
.chat-row { width: 100%; display: grid; gap: 6px; padding: 13px 12px; border: 0; border-radius: 12px; color: inherit; background: transparent; text-align: left; }
.chat-row:hover, .chat-row.is-active { background: var(--surface-soft); }
.chat-row.is-unread { background: #f0f4ff; }
.chat-row-top, .chat-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-row-top strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.chat-row-top time, .chat-meta { color: var(--muted); font-size: 11px; }
.chat-meta { flex-wrap: wrap; justify-content: flex-start; gap: 5px 7px; }
.chat-channel { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-assignment { order: 10; width: 100%; overflow: hidden; color: #68758a; text-overflow: ellipsis; white-space: nowrap; }
.chat-preview { overflow: hidden; color: #46536a; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.unread-badge { min-width: 21px; height: 21px; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 999px; color: #fff; background: var(--brand); font-weight: 750; }
.conversation-state { padding: 3px 6px; border-radius: 999px; color: #4b596e; background: #edf0f5; font-weight: 700; }
.conversation-state.status-open { color: #126243; background: #e4f8ef; }
.conversation-state.status-pending { color: #765614; background: #fff5d8; }
.conversation-state.status-closed { color: #6d3940; background: #f6e9eb; }
.empty-list { padding: 34px 14px; text-align: center; }
.empty-list p { color: var(--muted); font-size: 13px; }

.conversation-pane { display: flex; min-height: 0; overflow: hidden; }
.conversation-content { width: 100%; min-height: 0; display: flex; flex-direction: column; }
.conversation-header { padding: 16px 22px; border-bottom: 1px solid var(--line); }
.conversation-title-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.conversation-title-row h2 { margin: 0; font-size: 18px; }
.conversation-title-row p { margin: 3px 0 0; font-size: 12px; }
.conversation-header-context { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.conversation-header-context span { padding: 4px 7px; border-radius: 7px; color: #526077; background: #f1f3f7; font-size: 10px; font-weight: 650; }
.conversation-header-actions { display: flex; align-items: center; gap: 8px; }
.context-open { display: none; }
.window-badge { max-width: 220px; padding: 7px 10px; border-radius: 9px; font-size: 11px; font-weight: 700; text-align: center; }
.window-badge.is-open { color: #126243; background: #e4f8ef; }
.window-badge.is-closed { color: #8c3c33; background: #fceceb; }
.copilot-toggle { white-space: nowrap; }
.copilot-panel { flex: 0 0 auto; max-height: min(46vh,420px); padding: 14px 18px; overflow-y: auto; border-bottom: 1px solid var(--line); background: linear-gradient(135deg,#f7f9ff,#fff); }
.copilot-heading, .copilot-card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.copilot-heading h3 { margin: 2px 0 0; font-size: 16px; }
.copilot-state { padding: 5px 8px; border-radius: 999px; color: #46536a; background: #e8edf5; font-size: 10px; font-weight: 750; }
.copilot-state.is-ready { color: #126243; background: #e4f8ef; }
.copilot-state.is-unavailable { color: #8c3c33; background: #fceceb; }
.copilot-boundary { margin: 8px 0; color: #526077; font-size: 11px; line-height: 1.45; }
.copilot-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.copilot-actions button, .copilot-suggestion button { min-height: 34px; padding: 7px 10px; border: 1px solid #bdc8da; border-radius: 9px; color: var(--brand-dark); background: #fff; font-size: 11px; font-weight: 700; }
.copilot-actions button:disabled, .copilot-suggestion button:disabled { cursor: not-allowed; opacity: .55; }
.copilot-status { min-height: 18px; margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.copilot-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.copilot-card { min-width: 0; padding: 10px; border: 1px solid #dbe2f4; border-radius: 10px; background: #fff; }
.copilot-card-title span { color: var(--muted); font-size: 10px; }
.copilot-card p { margin: 7px 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.45; }
.copilot-suggestion { grid-column: 1/-1; }
.copilot-suggestion textarea { width: 100%; min-height: 72px; resize: vertical; padding: 9px; border: 1px solid #bdc8da; border-radius: 9px; color: var(--ink); background: #fff; font: inherit; }
.copilot-list { display: grid; gap: 3px; margin-top: 6px; color: #526077; font-size: 11px; }
.copilot-warning { display: block; margin-top: 8px; color: #765614; font-size: 11px; }
.copilot-review { color: #765614 !important; }
.copilot-grounding { display:grid; gap:6px; margin:8px 0; padding:8px 9px; border:1px solid #dbe2f4; border-radius:9px; background:#f7f9ff; color:#3f4d67; font-size:11px; }
.copilot-source-list { display:flex; flex-wrap:wrap; gap:5px; }
.copilot-source-chip { padding:3px 6px; border-radius:999px; background:#e7edff; color:#294cba; font-size:10px; font-weight:700; }
.copilot-grounding details summary { cursor:pointer; }
.copilot-draft-actions { display:flex; flex-wrap:wrap; gap:7px; margin-top:8px; }
.copilot-draft-actions button:last-child { color:#8c3c33; }
.message-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 20px; background: #f5f7fb; }
.message { align-self: flex-start; width: min(78%, 620px); padding: 10px 13px; border: 1px solid var(--line); border-radius: 6px 14px 14px; background: #fff; box-shadow: 0 4px 14px rgba(31,52,110,.05); }
.message-outbound { align-self: flex-end; border-color: #cad5ff; border-radius: 14px 6px 14px 14px; background: #eaf0ff; }
.message-system { align-self: center; width: auto; max-width: 88%; border: 0; border-radius: 999px; color: var(--muted); background: #e8edf5; box-shadow: none; text-align: center; }
.message p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-meta { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 10px; }
.reply-context { padding-left: 8px; border-left: 2px solid var(--brand); color: var(--muted); font-size: 11px; }
.delivery-status { margin-top: 4px; color: var(--muted); font-size: 10px; text-align: right; }
.chat-composer { position: sticky; bottom: 0; z-index: 2; display: grid; gap: 7px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); background: #fff; box-shadow: 0 -8px 24px rgba(31,52,110,.04); font-size: 12px; }
.composer-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.composer-heading > div { min-width: 0; display: grid; gap: 2px; }
.composer-heading strong, .chat-composer > label { color: var(--ink); font-weight: 750; }
.composer-heading > div span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-badge { max-width: 55%; padding: 5px 8px; overflow: hidden; border-radius: 999px; color: #29428f; background: #edf1ff; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.composer-controls { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; }
.chat-composer textarea { min-height: 44px; max-height: 120px; resize: vertical; padding: 9px 11px; border: 1px solid #bdc8da; border-radius: 9px; color: var(--ink); background: #fff; font: inherit; }
.chat-composer button { min-width: 92px; padding: 8px 13px; border: 0; border-radius: 9px; color: #fff; background: var(--brand); }
.chat-composer button:disabled, .chat-composer textarea:disabled { cursor: not-allowed; opacity: .55; }
.chat-composer #composer-message { color: #4d5a70; }
#composer-hint { color: #7c8798; font-size: 10px; }
.composer-reply { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-left: 3px solid var(--brand); border-radius: 7px; background: #f3f5fb; }
.composer-reply > div { min-width: 0; display: grid; gap: 2px; }
.composer-reply span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-composer .reply-cancel { min-width: 30px; width: 30px; height: 30px; padding: 0; color: var(--ink); background: transparent; font-size: 20px; }
.message-action { margin: 7px 7px 0 0; padding: 4px 7px; border: 1px solid #b8c4db; border-radius: 7px; color: var(--brand-dark); background: rgba(255,255,255,.72); font-size: 10px; font-weight: 700; }
.message-action:disabled { opacity: .55; }
.retry-action { color: #8b3c25; border-color: #e4b8aa; }
.ambiguity-warning { margin-top: 7px; padding: 7px 8px; border-radius: 7px; color: #7b3e16; background: #fff2df; font-size: 10px; line-height: 1.4; }
.message-failure { margin-top: 7px; padding: 7px 8px; border-radius: 7px; color: #8c3228; background: #fceceb; font-size: 10px; line-height: 1.4; }

.context-pane { padding: 8px 20px 28px; }
.workspace-heading { padding: 12px 0 4px; }
.workspace-heading h2 { margin: 4px 0 2px; overflow-wrap: anywhere; font-size: 20px; }
.workspace-heading p { margin: 0; overflow-wrap: anywhere; }
.workspace-location { margin-top: 8px !important; color: #344159; font-size: 12px; font-weight: 700; }
.workspace-status { padding: 8px 0; }
.context-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.context-section h2 { margin: 0 0 13px; font-size: 14px; }
.context-section h3 { margin: 15px 0 8px; color: #526077; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.context-section p { margin: 0; font-size: 13px; }
.context-section dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 12px; margin: 0 0 14px; font-size: 12px; }
.context-section dt { color: var(--muted); }
.context-section dd { margin: 0; overflow-wrap: anywhere; text-align: right; }
.context-control { display: grid; gap: 6px; margin: 12px 0 7px; color: var(--muted); font-size: 12px; }
.context-control select { width: 100%; }
.readonly-badge { display: inline-block; margin-left: 5px; padding: 3px 6px; border-radius: 999px; color: #35504a; background: #e9f6f1; font-size: 9px; font-weight: 760; vertical-align: middle; }
.workspace-list { display: grid; gap: 8px; }
.workspace-card { min-width: 0; display: grid; gap: 3px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #f8f9fc; overflow-wrap: anywhere; }
.workspace-card strong { color: #26344c; font-size: 12px; white-space: pre-wrap; }
.workspace-card span { color: var(--muted); font-size: 11px; }
.workspace-card.note-card { border-left: 3px solid #8095eb; background: #f4f6ff; }
.workspace-card.activity-card { position: relative; margin-left: 7px; border: 0; border-left: 2px solid #ccd5ea; border-radius: 0; background: transparent; }
.workspace-empty { padding: 10px; border-radius: 9px; color: var(--muted); background: #f7f8fb; font-size: 12px !important; }
.note-form { display: grid; gap: 7px; margin-top: 12px; }
.note-form label { color: #344159; font-size: 12px; font-weight: 700; }
.note-form textarea { width: 100%; min-height: 72px; resize: vertical; padding: 9px; border: 1px solid #bdc8da; border-radius: 9px; color: var(--ink); background: #fff; font: inherit; }
.note-form button { min-height: 40px; padding: 8px 11px; border: 0; border-radius: 9px; color: #fff; background: var(--brand); font-weight: 700; }
.note-form button:disabled { cursor: not-allowed; opacity: .55; }
.secondary-button { padding: 8px 11px; border: 1px solid #bdc8da; border-radius: 9px; color: var(--brand-dark); background: #fff; font-weight: 650; }
.load-more { align-self: center; margin: 8px auto; font-size: 12px; }
.center-state { margin: auto; padding: 30px; color: var(--muted); text-align: center; }
.center-state h2, .center-state h3 { margin: 8px 0; color: var(--ink); }
.center-state p { margin: 0; }
.center-state.compact { min-height: 180px; display: grid; place-items: center; }
.state-icon { font-size: 34px; }
.mobile-back { display: none; }

@media (max-width: 1240px) {
  .chats-shell { position: relative; grid-template-columns: minmax(260px, 320px) 1fr; }
  .context-pane { display: none; }
  .context-open { display: inline-block; }
  .mobile-context-open .context-pane {
    position: absolute;
    z-index: 5;
    top: 0;
    right: 0;
    bottom: 0;
    display: block;
    width: min(360px, 100%);
    box-shadow: -14px 0 32px rgba(31,52,110,.14);
  }
  .mobile-context-open #mobile-context-back { display: inline-block; margin: 8px 0 0; padding: 4px 0; border: 0; color: var(--brand-dark); background: transparent; }
}

@media (max-width: 900px) {
  .conversation-header { padding: 14px 12px; }
  .conversation-title-row { display: grid; gap: 9px; }
  .conversation-title-row > div, .conversation-header-actions { min-width: 0; }
  .conversation-header-actions { justify-content: space-between; gap: 6px; }
  .window-badge { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .chat-composer { padding: 10px 12px max(10px, env(safe-area-inset-bottom)); }
  .copilot-panel { max-height: min(52vh,460px); padding-inline: 12px; }
}

@media (max-width: 680px) {
  .app-header { height: 58px; padding: 0 14px; }
  .app-header .brand span:last-child { display: none; }
  .app-nav { gap: 12px; }
  .chats-shell { height: calc(100dvh - 58px); display: block; }
  .chat-list-pane, .conversation-pane, .context-pane { width: 100%; height: 100%; }
  .conversation-pane { display: none; }
  .mobile-conversation-open .chat-list-pane { display: none; }
  .mobile-conversation-open .conversation-pane { display: flex; }
  .mobile-context-open .conversation-pane { display: none; }
  .mobile-context-open .context-pane { position: static; display: block; width: 100%; box-shadow: none; }
  .mobile-back { display: inline-block; margin: 0 0 9px; padding: 4px 0; border: 0; color: var(--brand-dark); background: transparent; }
  .window-badge { max-width: 150px; }
  .conversation-title-row { align-items: flex-start; }
  .conversation-header-actions { flex-direction: column; align-items: flex-end; }
  .copilot-grid { grid-template-columns: 1fr; }
  .copilot-suggestion { grid-column: auto; }
  .copilot-panel { max-height: 48dvh; }
  .message { width: min(88%, 620px); }
  .composer-controls { grid-template-columns: minmax(0,1fr) 88px; }
  .chat-composer button { min-width: 88px; }
  #composer-hint { display: none; }
  .inbox-search { position: sticky; top: 0; z-index: 3; padding-inline: 12px; background: #fff; }
  .inbox-queues { padding-inline: 12px; }
  .filter-toolbar, .active-filter-summary { padding-inline: 12px; }
  .inbox-filter-panel { position: fixed; z-index: 20; right: 0; bottom: calc(var(--shell-bottom,68px) + env(safe-area-inset-bottom)); left: 0; max-height: min(calc(78dvh - var(--shell-bottom,68px)),680px); margin: 0; padding: 18px 16px 20px; overflow-y: auto; border-radius: 18px 18px 0 0; box-shadow: 0 -18px 50px rgba(20,31,55,.24); }
}

/* Provider-neutral template lifecycle */
.templates-body { overflow: auto; }
.templates-shell { min-height: calc(100vh - 64px); display: grid; grid-template-columns: minmax(250px, 310px) minmax(520px, 1fr) minmax(260px, 330px); gap: 1px; background: var(--line); }
.template-list-pane, .template-editor-pane, .template-preview-pane { min-width: 0; background: #fff; }
.template-list { display: grid; gap: 5px; padding: 8px 12px 28px; }
.template-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px 10px; padding: 13px; border: 0; border-radius: 12px; color: var(--ink); background: transparent; text-align: left; }
.template-row:hover { background: var(--surface-soft); }
.template-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-row > span:not(.template-status) { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.template-status { align-self: start; padding: 4px 7px; border-radius: 999px; color: #41506a; background: #edf0f5; font-size: 10px; font-weight: 760; }
.status-approved { color: #126243; background: #e4f8ef; }
.status-rejected, .status-disabled { color: #8c3c33; background: #fceceb; }
.status-pending, .status-submitted, .status-paused { color: #765614; background: #fff5d8; }
.template-editor-pane { padding: 28px clamp(20px,4vw,48px) 48px; }
.template-form { max-width: 820px; display: grid; gap: 18px; margin: 0 auto; }
.template-form-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.template-form-heading h2, .template-preview-pane h2 { margin: 2px 0 0; }
.template-form label { display: grid; gap: 7px; color: #344159; font-size: 13px; font-weight: 650; }
.template-form input, .template-form select, .template-form textarea { width: 100%; padding: 10px 11px; border: 1px solid #bdc8da; border-radius: 9px; color: var(--ink); background: #fff; font: inherit; }
.template-form textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field-label { margin: 0 0 8px; color: #344159; font-size: 13px; font-weight: 650; }
.variables-editor { display: grid; gap: 8px; }
.variable-row { display: grid; grid-template-columns: 54px minmax(120px,1fr) minmax(160px,1.4fr); align-items: center; gap: 8px; }
.variable-row span { font-family: ui-monospace,SFMono-Regular,Menlo,monospace; color: var(--brand-dark); }
.template-hint { margin: -6px 0 0; font-size: 12px; }
.template-form .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.template-form .actions .secondary-button { color: var(--brand-dark); background: #fff; border: 1px solid #bdc8da; }
.template-preview-pane { padding: 30px 22px; background: #eef2f5; }
.wa-preview { position: relative; margin: 22px 0 14px; padding: 11px 12px 19px; border-radius: 6px 14px 14px 14px; color: #18202d; background: #fff; box-shadow: 0 5px 20px rgba(31,52,110,.12); white-space: pre-wrap; overflow-wrap: anywhere; }
.wa-preview-header { margin-bottom: 5px; font-weight: 750; }
.wa-preview-footer { margin-top: 7px; padding-right: 42px; color: #728096; font-size: 11px; }
.wa-preview time { position: absolute; right: 9px; bottom: 6px; color: #8691a3; font-size: 9px; }
@media (max-width: 1050px) { .templates-shell { grid-template-columns: 270px 1fr; } .template-preview-pane { display: none; } }
@media (max-width: 720px) { .templates-shell { display: block; } .template-list-pane { min-height: auto; border-bottom: 1px solid var(--line); } .template-editor-pane { padding: 22px 16px 40px; } .form-grid { grid-template-columns: 1fr; } .variable-row { grid-template-columns: 48px 1fr; } .variable-row input:last-child { grid-column: 2; } }

.automation-body { overflow: auto; }
.automation-page { max-width: 1180px; margin: 0 auto; padding: 34px 24px 92px; }
.automation-heading, .automation-section-title { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.automation-heading { margin-bottom: 18px; }
.automation-heading h1, .automation-section-title h2 { margin: 0; }
.automation-mode, .rule-state { border-radius: 999px; padding: 7px 11px; font-size: .78rem; font-weight: 750; white-space: nowrap; }
.automation-mode { color: #8b5211; background: #fff4d8; border: 1px solid #efcf8d; }
.state-enabled { color: #18664b; background: #e9f8f1; }
.state-draft { color: #4d5973; background: #eef1f7; }
.state-paused { color: #8b5211; background: #fff4d8; }
.state-disabled { color: #8b3e2f; background: #fff0eb; }
.automation-toolbar { display: flex; gap: 8px; margin: 22px 0 30px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.automation-toolbar button[aria-pressed="true"] { color: white; background: var(--brand); }
.automation-section-title { align-items: center; margin-bottom: 16px; }
.automation-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.automation-card { min-width: 0; display: grid; gap: 9px; overflow-wrap: anywhere; text-align: left; padding: 19px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.automation-card:hover, .automation-card:focus-visible { border-color: var(--brand); box-shadow: 0 8px 24px rgba(25,55,80,.08); }
.automation-card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.automation-card > span:not(.automation-card-top) { color: var(--muted); font-size: .88rem; }
.automation-card .automation-health { padding-top: 8px; border-top: 1px solid var(--line); color: #344767; font-weight: 650; }
.automation-empty { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }
.automation-editor { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.automation-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.automation-form-grid fieldset { min-width: 0; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; }
.automation-form-grid legend { padding: 0 6px; font-weight: 750; }
.automation-form-grid label, .automation-dry-controls label { display: grid; gap: 6px; margin: 10px 0; font-size: .88rem; font-weight: 650; }
.automation-form-grid input, .automation-form-grid textarea, .automation-form-grid select, .automation-dry-controls select { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); font: inherit; }
.automation-form-grid :disabled { color: #687387; background: #f3f5f8; cursor: not-allowed; }
.field-hint { color: var(--muted); font-size: .78rem; font-weight: 450; }
.automation-time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.automation-test-callout { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 12px; border-radius: 11px; color: #71450b; background: #fff4d8; }
.automation-review, .automation-dry-run { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.automation-review h3, .automation-dry-run h3 { margin-top: 0; }
.automation-review dl { display: grid; grid-template-columns: minmax(100px,160px) 1fr; gap: 7px 14px; margin-bottom: 0; }
.automation-review dt { color: var(--muted); }.automation-review dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.automation-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.automation-dry-controls { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: end; }
.automation-result { display: grid; gap: 7px; margin-top: 14px; padding: 14px; border-left: 4px solid var(--brand); border-radius: 8px; background: white; }
.automation-no-send { color: #18664b; font-weight: 750; }
.automation-history-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.automation-history { width: 100%; border-collapse: collapse; font-size: .86rem; }
.automation-history th, .automation-history td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.automation-history tr:last-child td { border-bottom: 0; }.automation-history th { color: var(--muted); background: #f8fafc; }
.automation-history-cards { display: none; }.automation-history-card { gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }.automation-history-card span { color: var(--muted); font-size: .84rem; }
@media (max-width: 720px) {
  .automation-page { padding: 24px 16px 96px; }.automation-heading { display: block; }.automation-mode { display: inline-block; margin-top: 12px; }
  .automation-toolbar { position: sticky; top: 0; z-index: 2; overflow-x: auto; padding: 10px 0 12px; background: var(--bg); }
  .automation-grid, .automation-form-grid { grid-template-columns: 1fr; }.automation-editor { padding: 16px 12px; }
  .automation-dry-controls { grid-template-columns: 1fr; }.automation-dry-controls button { width: 100%; }
  .automation-history-wrap { display: none; }.automation-history-cards { display: grid; gap: 10px; }
  .automation-history-card { display: grid; }.automation-actions button { flex: 1 1 150px; }
}
