:root {
  color-scheme: light;
  --ink: #182d35;
  --muted: #5b6c72;
  --accent: #096f68;
  --accent-hover: #075951;
  --line: #dce3e3;
  --paper: #fff;
  --canvas: #f3f2ee;
  --soft: #eff6f4;
  --danger: #a32d37;
  --radius: 12px;
  font:
    15px/1.5 "Segoe UI",
    system-ui,
    sans-serif;
  color: var(--ink);
  background: #e8eeec;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
summary {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
button {
  border: 0;
  background: none;
  color: inherit;
}
button,
input,
select,
textarea {
  border-radius: 8px;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #198aab;
  outline-offset: 3px;
}
input,
select,
textarea {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  min-width: 0;
}
button,
select {
  min-height: 44px;
}
input,
textarea {
  caret-color: var(--accent);
}
textarea {
  resize: none;
  max-height: 140px;
}
::selection {
  background: #bce8e1;
  color: #123d39;
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
}
svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 20px;
  letter-spacing: -0.025em;
}
h2 {
  font-size: 19px;
  letter-spacing: -0.02em;
}
h3 {
  font-size: 13px;
  margin: 24px 0 14px;
}
button {
  transition: background 0.15s ease-out;
}
button:hover {
  background: var(--soft);
}
[hidden] {
  display: none !important;
}
.muted,
.demo-note {
  color: var(--muted);
  font-size: 12px;
}
.primary {
  background: var(--accent);
  color: white;
  padding: 10px 18px;
  font-weight: 600;
}
.primary:hover {
  background: var(--accent-hover);
}
.compact {
  padding: 8px 13px;
  font-size: 13px;
}
.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
}
.text-button {
  color: var(--accent);
  font-size: 13px;
  padding: 6px 10px;
  font-weight: 600;
}
.brand-symbol {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  background: var(--ink);
  color: white;
  font-size: 29px;
  font-weight: 600;
  border-radius: 13px;
}
.brand-symbol.small {
  width: 40px;
  height: 40px;
  font-size: 23px;
  border-radius: 10px;
}
.login-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(130deg, #e6efec, #f6f4ef);
}
.login-form {
  display: grid;
  gap: 20px;
  width: min(100%, 410px);
  background: white;
  padding: 36px;
  border-radius: 18px;
  box-shadow: 0 18px 65px #153e3512;
}
.login-form h1 {
  font-size: 29px;
}
.login-form p {
  color: var(--muted);
}
.login-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.login-form .error {
  color: var(--danger);
  font-size: 13px;
}
.login-form .demo-note {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
main {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  height: 100dvh;
  max-width: 1800px;
  margin: auto;
  background: var(--paper);
  overflow: hidden;
}
.inbox {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: white;
}
.brand-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--line);
}
.brand-bar #logout {
  margin-left: auto;
}
.inbox-tools {
  padding: 13px 18px 14px;
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.team-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.search-label {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding-left: 12px;
  background: #f7f9f8;
}
.search-label input {
  width: 100%;
  border: 0;
  background: transparent;
}
.search-label svg {
  width: 17px;
  color: var(--muted);
}
.filter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.filter-label select {
  border: 0;
  background: #eff3f2;
  flex: 1;
  font-size: 13px;
  min-height: 36px;
  padding: 5px 8px;
}
.conversation-list {
  overflow: auto;
  flex: 1;
}
.conversation-row {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 17px 18px;
  border-radius: 0;
  border-bottom: 1px solid #edf0ef;
}
.conversation-row.active {
  background: #e9f4ef;
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e3eae8;
  color: #41615b;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}
.conversation-info {
  min-width: 0;
  flex: 1;
}
.conversation-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 7px;
}
.conversation-title strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-phone {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.conversation-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
}
.unread {
  min-width: 22px;
  height: 22px;
  padding: 1px 6px;
  background: var(--accent);
  color: white;
  border-radius: 12px;
  font-size: 12px;
  text-align: center;
}
.inbox-footer {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 15px;
  font-size: 11px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.mode {
  margin-left: auto;
  background: #e7f3ee;
  color: #255f4e;
  padding: 3px 7px;
  border-radius: 5px;
}
.chat {
  min-width: 0;
  min-height: 0;
  position: relative;
  background: var(--canvas);
}
#active-chat {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 24px;
  background: white;
  border-bottom: 1px solid var(--line);
  min-height: 85px;
}
.chat-identity {
  min-width: 0;
  flex: 1;
}
.chat-identity h2 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-identity p {
  font-size: 12px;
  color: var(--muted);
}
.back {
  display: none;
}
.attention-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 22px;
  background: #fcfdfc;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.attention-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.attention-actions label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}
.attention-actions select {
  max-width: 130px;
  font-size: 12px;
  min-height: 36px;
  padding: 5px;
}
.badge {
  font-size: 12px;
  font-weight: 600;
  background: #e6ece9;
  color: #305a4e;
  padding: 5px 8px;
  border-radius: 5px;
}
.notice {
  padding: 10px 22px;
  background: #fff3db;
  color: #765015;
  font-size: 13px;
}
.messages {
  flex: 1;
  overflow: auto;
  min-height: 0;
  padding: 24px 28px;
  scroll-behavior: smooth;
}
#message-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.day-divider {
  align-self: center;
  color: var(--muted);
  background: #fff9;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  margin: 12px 0;
}
.bubble {
  max-width: min(78%, 640px);
  padding: 11px 13px;
  background: white;
  border-radius: 0 12px 12px 12px;
  align-self: flex-start;
  overflow-wrap: anywhere;
}
.bubble.outbound {
  align-self: flex-end;
  background: #dcefe5;
  border-radius: 12px 0 12px 12px;
}
.bubble p {
  white-space: pre-wrap;
}
.bubble-footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  align-items: center;
  font-size: 10px;
  color: #526a61;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.bubble.failed {
  outline: 1px solid #cfa2a3;
}
.bubble.failed .bubble-footer {
  color: var(--danger);
}
.media-pending {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: #f1f3f2;
  border-radius: 8px;
  font-size: 13px;
}
.media-pending small {
  color: var(--muted);
}
.media-file {
  display: grid;
  gap: 6px;
  margin-bottom: 6px;
}
.media-file img {
  display: block;
  width: min(100%, 320px);
  max-height: 280px;
  object-fit: cover;
  border-radius: 8px;
  cursor: zoom-in;
}
.media-preview {
  padding: 0;
  justify-self: start;
  min-height: 44px;
  border-radius: 8px;
}
.recording {
  color: var(--danger);
  outline: 2px solid var(--danger);
}
.media-file video {
  width: min(100%, 350px);
  max-height: 280px;
  border-radius: 8px;
  background: #101e20;
}
.media-file audio {
  max-width: 100%;
  width: 280px;
}
.media-file a {
  font-size: 13px;
}
.media-file small {
  color: var(--muted);
  font-size: 11px;
}
.older {
  display: block;
  margin: 0 auto 14px;
  background: white;
  color: var(--accent);
  padding: 8px 12px;
  font-size: 12px;
}
.composer-area {
  background: white;
  border-top: 1px solid var(--line);
  padding: 10px 18px 8px;
}
.composer-help {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}
.composer textarea {
  flex: 1;
  min-height: 44px;
  border: 0;
  background: #f2f5f3;
  padding: 11px 13px;
  line-height: 1.5;
}
.send-button {
  display: grid;
  place-items: center;
  width: 46px;
  min-width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  margin-left: 6px;
}
.send-button:hover {
  background: var(--accent-hover);
}
.composer-foot {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  margin-top: 7px;
  padding: 0 6px;
}
.attachment-drafts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.attachment-draft {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--soft);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 6px;
  max-width: 100%;
}
.attachment-draft span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-draft button {
  min-height: 28px;
}
.emoji-picker {
  position: relative;
}
.emoji-picker summary {
  list-style: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 44px;
  border-radius: 8px;
}
.emoji-picker summary::-webkit-details-marker {
  display: none;
}
#emoji-options {
  position: absolute;
  bottom: 55px;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 38px);
  background: white;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  z-index: 2;
}
#emoji-options button {
  font-size: 20px;
  min-height: 38px;
}
.empty-chat {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  gap: 14px;
}
.empty-chat h2 {
  font-size: 25px;
  max-width: 460px;
}
.empty-chat p {
  max-width: 360px;
  color: var(--muted);
}
.empty-chat > span {
  font-size: 11px;
  margin-top: 38px;
  color: var(--muted);
}
.empty-mark {
  width: 66px;
  height: 54px;
  border: 2px solid #86a69b;
  border-radius: 18px 18px 18px 0;
  margin-bottom: 14px;
}
.empty-list {
  padding: 36px 25px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.profile {
  position: absolute;
  right: 0;
  top: 0;
  width: 330px;
  height: 100dvh;
  background: white;
  border-left: 1px solid var(--line);
  overflow: auto;
  padding: 22px;
  z-index: 3;
  box-shadow: -9px 0 28px #17392c12;
}
.profile header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.profile dl {
  display: grid;
  gap: 4px;
  margin: 0;
}
.profile dt {
  color: var(--muted);
  font-size: 11px;
  margin-top: 10px;
}
.profile dd {
  margin: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.profile ol {
  padding-left: 18px;
  font-size: 12px;
}
.profile li {
  margin-bottom: 15px;
}
.profile time {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.retention {
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 15px;
  margin-top: 25px;
}
dialog {
  border: 0;
  border-radius: 12px;
  padding: 20px;
  max-width: min(92vw, 1000px);
  color: var(--ink);
}
dialog::backdrop {
  background: #102b33ce;
}
dialog img {
  display: block;
  max-width: 85vw;
  max-height: 75dvh;
}
dialog .icon-button {
  display: block;
  margin-left: auto;
}
dialog p {
  font-size: 13px;
  margin-top: 9px;
}
* {
  scrollbar-width: thin;
  scrollbar-color: #b2c5bd transparent;
}
@media (max-width: 1000px) {
  main {
    grid-template-columns: 310px minmax(0, 1fr);
  }
  .chat-header {
    padding: 16px;
  }
  .messages {
    padding: 18px;
  }
  .attention-toolbar {
    padding: 10px 14px;
  }
  .attention-actions {
    gap: 1px;
  }
  .attention-actions .text-button {
    padding: 6px;
  }
  .composer-area {
    padding: 9px 10px;
  }
  .composer .icon-button {
    min-width: 36px;
  }
  .composer {
    gap: 0;
  }
}
@media (max-width: 700px) {
  main {
    display: block;
  }
  .inbox {
    height: 100dvh;
    width: 100%;
  }
  .chat {
    display: none;
    height: 100dvh;
  }
  main[data-selected] .inbox {
    display: none;
  }
  main[data-selected] .chat {
    display: block;
  }
  .back {
    display: inline-grid;
  }
  .chat-header {
    min-height: 75px;
    padding: 10px 12px;
    gap: 8px;
  }
  .chat-header h2 {
    font-size: 17px;
  }
  .chat-header .avatar {
    width: 38px;
    height: 38px;
    font-size: 13px;
  }
  .attention-toolbar {
    padding: 7px 12px;
  }
  .attention-actions label {
    font-size: 0;
  }
  .attention-actions select {
    font-size: 12px;
    max-width: 108px;
  }
  .attention-actions .text-button {
    font-size: 11px;
  }
  .messages {
    padding: 12px;
  }
  .bubble {
    max-width: 88%;
  }
  .composer-area {
    padding: 8px;
  }
  .composer textarea {
    font-size: 16px;
  }
  .composer-foot {
    font-size: 9px;
  }
  .profile {
    width: min(100%, 360px);
  }
  .brand-bar {
    padding: 18px;
  }
  .login-form {
    padding: 26px;
  }
  .empty-chat {
    display: none;
  }
  .media-file audio {
    width: 240px;
  }
  .composer .icon-button {
    min-width: 34px;
    width: 34px;
  }
  .emoji-picker summary {
    width: 34px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.part-status {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}

.origin-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.origin-form label {
  display: grid;
  gap: 5px;
  font-size: 12px;
}
.origin-form input,
.origin-form select,
.origin-form textarea {
  width: 100%;
}
#origin-editor summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
  color: var(--accent);
  font-weight: 600;
}
#origin-fields dd {
  white-space: pre-wrap;
}
.desk-admin { height: 100dvh; overflow: auto; padding: clamp(16px, 4vw, 48px); background: var(--paper,#fff); color: var(--ink,#182d35); }
.desk-admin > * { max-width: 1050px; margin-inline: auto; }
.admin-header,.admin-section-header,.admin-buttons { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-header { border-bottom: 1px solid var(--line,#dce3e3); padding-bottom: 16px; }
.admin-header h1 { margin: 0; font-size: clamp(1.35rem, 3vw, 1.8rem); }
.admin-header p,.admin-form p { margin: 5px 0; }
.admin-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.45fr); gap: clamp(18px, 5vw, 56px); }
.admin-grid h2,.admin-audit h2 { font-size: 1.05rem; margin: 12px 0; }
.admin-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.admin-form label { display: grid; align-content: start; gap: 5px; font-weight: 600; }
.admin-form input:not([type=checkbox]),.admin-form select { min-width: 0; width: 100%; }
.admin-form .admin-check { display: flex; align-items: center; gap: 8px; font-weight: normal; min-height: 36px; }
.admin-form fieldset,.admin-form p,.admin-form h2,.admin-form > div { grid-column: 1 / -1; }
.admin-form fieldset { border: 1px solid var(--line,#dce3e3); }
.admin-list { list-style: none; padding: 0; margin: 0; }
.admin-list li { border-bottom: 1px solid var(--line,#dce3e3); padding: 8px 0; overflow-wrap: anywhere; }
.admin-list button { width: 100%; text-align: left; }
.admin-list button[aria-current=true] { background: var(--selected,#e9f4ef); }
.admin-list small { display: block; color: var(--muted,#5b6c72); }
.admin-feedback { position: sticky; top: 0; z-index: 2; min-height: 24px; color: var(--muted,#5b6c72); margin-block: 10px; background: var(--paper,#fff); }
.admin-link label:has([name=evidence]) { grid-column: 1 / -1; }
.admin-link,.admin-audit { border-top: 1px solid var(--line,#dce3e3); padding-top: 10px; margin-top: 20px; }
@media (max-width: 700px) { .admin-grid,.admin-form { grid-template-columns: minmax(0,1fr); } }
