.cw-mask {
  position: fixed;
  inset: 0;
  z-index: 10000;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(25, 33, 43, 0.42);
}
.cw-dialog {
  width: min(1280px, 100%);
  height: min(900px, calc(100dvh - 48px));
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 60px #0002;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #24313c;
  font: 14px/1.55 inherit;
  animation: cw-enter 0.16s ease-out;
}
.cw-dialog * {
  box-sizing: border-box;
  letter-spacing: 0;
}
.cw-header {
  padding: 18px 24px;
  border-bottom: 1px solid #e7ebee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}
.cw-header h2 {
  font-size: 18px;
  margin: 0;
  font-weight: 650;
}
.cw-header p {
  font-size: 13px;
  color: #74808a;
  margin: 2px 0 0;
}
.cw-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid #e1e6eb;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  color: #52616d;
}
.cw-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.cw-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.cw-sidebar {
  overflow: auto;
  padding: 24px;
  background: #fafbfc;
  border-right: 1px solid #edf0f3;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.cw-person-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #eaf3f3;
  color: #21685e;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 650;
}
.cw-sidebar strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}
.cw-contact-email {
  font-size: 12px;
  color: #65737e;
  overflow-wrap: anywhere;
}
.cw-sidebar dl {
  width: 100%;
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cw-sidebar dt {
  font-size: 12px;
  color: #7a8791;
  margin-top: 12px;
}
.cw-sidebar dd {
  margin: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.cw-next-task {
  border-top: 1px solid #e1e7eb;
  padding-top: 18px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cw-next-task p {
  margin: 4px 0;
  font-size: 13px;
}
.cw-next-task span {
  display: block;
  font-size: 12px;
  color: #73808b;
}
.cw-next-task .cw-overdue {
  color: #ad363d;
}
.cw-main {
  margin-left: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.cw-tabs {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid #e7ebee;
  flex-shrink: 0;
  overflow-x: auto;
}
.cw-tabs button {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  border-radius: 0;
  height: 50px;
  padding: 0 0;
  white-space: nowrap;
  font-family: inherit;
  font-size: 13px;
  color: #71808b;
  cursor: pointer;
}
.cw-tabs button.is-active {
  border-bottom-color: #216bb0;
  color: #216bb0;
  font-weight: 650;
}
.cw-tabs button:last-child {
  margin-left: auto;
}
.cw-tabs span:not(.cw-icon) {
  font-size: 12px;
  background: #edf3f8;
  padding: 0 5px;
  border-radius: 4px;
}
.cw-content {
  overflow: auto;
  padding: 24px;
  min-height: 0;
  flex: 1;
}
.cw-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.cw-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 16px;
  max-width: 100%;
  border: 1px solid #dce3e9;
  border-radius: 6px;
  background: #fff;
  color: #435561;
  font: 500 13px/1.3 inherit;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    box-shadow 0.2s;
  white-space: normal;
  text-align: center;
}
.cw-btn:hover,
.cw-icon-btn:hover {
  background: #f4f7fa;
  border-color: #bac9d5;
}
.cw-btn:active,
.cw-icon-btn:active {
  box-shadow: inset 0 2px 3px #0001;
  transform: translateY(1px);
}
.cw-btn.cw-primary {
  background: #216bb0;
  border-color: #216bb0;
  color: white;
}
.cw-btn.cw-primary:hover {
  background: #195c99;
}
.cw-dialog button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.cw-mailbox-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #6c7b87;
  margin: 12px 0 20px;
  overflow-wrap: anywhere;
}
.cw-mailbox-line time {
  margin-left: auto;
}
.cw-composer {
  border: 1px solid #d7e2eb;
  border-radius: 6px;
  margin-bottom: 24px;
  overflow: hidden;
  background: #fff;
}
.cw-composer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: #f8fafb;
}
.cw-composer-head strong {
  font-size: 14px;
}
.cw-composer > .cw-address {
  padding: 6px 16px;
}
.cw-composer > .cw-field {
  padding: 12px 16px;
}
.cw-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #647481;
  font-weight: 500;
  min-width: 0;
  margin-bottom: 16px;
}
.cw-field input,
.cw-field select,
.cw-field textarea {
  width: 100%;
  min-width: 0;
  background: #fff;
  border: 1px solid #dce3e8;
  border-radius: 6px;
  padding: 9px 11px;
  height: 38px;
  font-family: inherit;
  font-size: 14px;
  color: #25333d;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}
.cw-field textarea {
  height: 104px;
  min-height: 90px;
  resize: vertical;
  line-height: 1.55;
}
.cw-field input:focus,
.cw-field select:focus,
.cw-field textarea:focus,
.cw-editor:focus {
  outline: none;
  border-color: #4a85ad;
  box-shadow: 0 0 0 3px #2873a510;
}
.cw-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fafbfc;
  border-block: 1px solid #e9eef2;
  flex-wrap: wrap;
}
.cw-editor-toolbar .cw-btn {
  margin-left: auto;
  font-size: 12px;
}
.cw-editor {
  min-height: 200px;
  padding: 18px 20px;
  outline: none;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  direction: ltr;
  overflow-wrap: anywhere;
}
.cw-editor * {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
.cw-editor p,
.cw-mail-body p {
  margin: 0 0 12px;
}
.cw-editor ul,
.cw-editor ol,
.cw-mail-body ul,
.cw-mail-body ol {
  padding-left: 24px;
  margin: 10px 0 14px;
  list-style-position: outside;
}
.cw-editor li,
.cw-mail-body li {
  margin: 4px 0;
  line-height: 1.65;
}
.cw-editor ul {
  list-style-type: disc;
}
.cw-editor ol {
  list-style-type: decimal;
}
.cw-composer-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid #e9eef2;
  flex-wrap: wrap;
}
.cw-composer-footer > .cw-primary {
  margin-left: auto;
}
.cw-upload input {
  display: none;
}
.cw-caption {
  font-size: 12px;
  color: #7d8992;
}
.cw-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}
.cw-composer > .cw-attachments {
  padding: 0 16px 12px;
}
.cw-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid #e0e7ed;
  border-radius: 4px;
  background: #f9fbfd;
  font: 12px/1.5 inherit;
  color: #38739a;
  cursor: pointer;
  padding: 6px 9px;
  text-align: left;
}
.cw-timeline {
  margin-top: 8px;
}
.cw-entry {
  padding: 20px 0;
  border-bottom: 1px solid #e9edf0;
  overflow-wrap: anywhere;
}
.cw-entry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.cw-entry-top time {
  font-size: 12px;
  color: #82909b;
}
.cw-entry h3 {
  font-size: 14px;
  font-weight: 650;
  margin: 10px 0 6px;
}
.cw-address {
  font-size: 12px;
  color: #72828e;
  overflow-wrap: anywhere;
}
.cw-thread {
  display: block;
  font-size: 12px;
  color: #3178a3;
  margin-top: 8px;
}
.cw-status {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  font-weight: 550;
  color: #507384;
}
.cw-status-received,
.cw-status-sent {
  color: #20735e;
}
.cw-status-failed,
.cw-status-uncertain {
  color: #ae3c42;
}
.cw-email-detail {
  margin: 12px 0;
}
.cw-email-detail summary {
  font-size: 12px;
  color: #316da0;
  cursor: pointer;
  padding: 5px 0;
}
.cw-mail-body {
  font-size: 14px;
  line-height: 1.65;
  margin: 10px 0;
  color: #334550;
  overflow-wrap: anywhere;
  max-height: 540px;
  overflow: auto;
}
.cw-mail-body * {
  max-width: 100%;
  font-family: inherit;
}
.cw-mail-body blockquote {
  border-left: 2px solid #d9e3e9;
  margin: 12px 0;
  padding: 0 14px;
  color: #7b8992;
}
.cw-entry-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.cw-entry-actions .cw-btn {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 12px;
}
.cw-record-text {
  white-space: pre-wrap;
  font-size: 13px;
  color: #586875;
  margin: 10px 0;
}
.cw-grid,
.cw-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}
.cw-note-form,
.cw-task-form {
  padding: 18px 0;
  margin: 0 0 24px;
  border-bottom: 1px solid #e5eaee;
}
.cw-section-title {
  font-size: 14px;
  font-weight: 650;
  margin: 0 0 12px;
}
.cw-task-outcome {
  padding: 18px 0;
  margin-top: 20px;
  border-top: 2px solid #4584ad;
}
.cw-task-outcome h3 {
  font-size: 14px;
  margin: 0 0 14px;
}
.cw-overdue {
  color: #ad363d;
  font-size: 12px;
}
.cw-table-scroll {
  overflow: auto;
  max-width: 100%;
}
.cw-table-scroll table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 13px;
}
.cw-table-scroll th {
  font-size: 12px;
  color: #72818b;
  background: #f7f9fb;
  white-space: nowrap;
  text-align: left;
  padding: 10px 12px;
}
.cw-table-scroll td {
  padding: 12px;
  border-bottom: 1px solid #edf0f2;
}
.cw-table-scroll tbody tr:hover {
  background: #fafcfd;
}
.cw-error,
.cw-notice {
  padding: 10px 16px;
  font-size: 13px;
  overflow-wrap: anywhere;
  border-radius: 4px;
  margin: 12px 24px 0;
}
.cw-error {
  background: #fff3f3;
  color: #a4393d;
}
.cw-notice {
  background: #eef7f2;
  color: #236848;
}
.cw-content .cw-error {
  margin: 12px 0;
}
.cw-empty {
  padding: 40px 16px;
  text-align: center;
  color: #8a969f;
  font-size: 13px;
}
.cw-loading {
  padding: 24px;
}
.cw-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  border-top: 1px solid #e7ebee;
  flex-shrink: 0;
}
.cw-footer > span {
  font-size: 12px;
  color: #82909b;
}
.cw-dialog :focus-visible {
  outline: 2px solid #4386b2;
  outline-offset: 2px;
}
@keyframes cw-enter {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@media (max-width: 900px) {
  .cw-mask {
    padding: 10px;
  }
  .cw-dialog {
    height: calc(100dvh - 20px);
  }
  .cw-body {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .cw-sidebar {
    padding: 18px;
  }
  .cw-content {
    padding: 18px;
  }
  .cw-tabs {
    padding: 0 18px;
    gap: 14px;
  }
  .cw-mailbox-line time {
    margin-left: 0;
  }
  .cw-composer-head {
    flex-wrap: wrap;
  }
}
@media (max-width: 640px) {
  .cw-mask {
    padding: 6px;
  }
  .cw-dialog {
    height: calc(100dvh - 12px);
  }
  .cw-body {
    display: flex;
    flex-direction: column;
    overflow: auto;
  }
  .cw-sidebar {
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid #edf0f3;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 6px 12px;
    padding: 14px;
  }
  .cw-person-avatar {
    grid-row: 1/3;
  }
  .cw-sidebar > .cw-contact-email,
  .cw-sidebar > .badge {
    grid-column: 2;
  }
  .cw-sidebar dl,
  .cw-next-task {
    display: none;
  }
  .cw-main {
    flex-shrink: 0;
    overflow: visible;
  }
  .cw-content {
    overflow: visible;
    padding: 16px;
  }
  .cw-header {
    padding: 14px 16px;
  }
  .cw-header h2 {
    font-size: 16px;
  }
  .cw-tabs {
    gap: 16px;
    padding: 0 16px;
  }
  .cw-grid,
  .cw-profile-grid {
    grid-template-columns: 1fr;
  }
  .cw-footer {
    padding: 10px 16px;
  }
  .cw-footer > span {
    max-width: 60%;
    overflow-wrap: anywhere;
  }
  .cw-entry-top {
    align-items: flex-start;
  }
  .cw-composer-head .cw-btn {
    padding: 6px 8px;
    font-size: 12px;
  }
  .cw-editor-toolbar .cw-btn {
    margin-left: 0;
  }
  .cw-dialog .cw-error,
  .cw-dialog .cw-notice {
    margin-inline: 16px;
  }
  .cw-composer-footer > .cw-primary {
    margin-left: 0;
  }
  .cw-btn {
    padding: 8px 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cw-dialog {
    animation: none;
  }
  .cw-btn,
  .cw-field input,
  .cw-field select,
  .cw-field textarea {
    transition: none;
  }
}
.cw-archive-body{display:grid;grid-template-columns:320px minmax(0,1fr);flex:1;min-height:0;overflow:hidden}.cw-archive-list{padding:20px;overflow:auto;background:#fafbfc;border-right:1px solid #e7ebee}.cw-archive-detail{padding:24px;overflow:auto;min-width:0}.cw-archive-contact{display:flex;flex-direction:column;gap:4px;width:100%;padding:12px 10px;margin-bottom:8px;border:1px solid transparent;border-radius:6px;background:transparent;text-align:left;font-family:inherit;cursor:pointer;overflow-wrap:anywhere}.cw-archive-contact strong{font-size:14px;color:#32424e}.cw-archive-contact span,.cw-archive-contact time{font-size:12px;color:#74838d}.cw-archive-contact:hover{background:#f0f4f7}.cw-archive-contact.is-active{background:#eaf2f8;border-color:#d0e0ed}.cw-archive-list .list-pagination{flex-wrap:wrap;gap:8px;padding:12px 0;font-size:12px}.cw-archive-list .list-pagination-actions{flex-wrap:wrap;gap:6px}
@media(max-width:640px){.cw-archive-body{display:flex;flex-direction:column;overflow:auto}.cw-archive-list{overflow:visible;border-right:0}.cw-archive-detail{overflow:visible;padding:16px}}
.cw-record-tabs{display:flex;gap:0;border-bottom:1px solid var(--border,#dce4eb);margin-bottom:16px}
.cw-record-tabs button{border:0;border-bottom:2px solid transparent;background:transparent;padding:10px 16px;color:#617385;font:inherit;cursor:pointer}
.cw-record-tabs button[aria-selected=true]{color:#21699a;border-bottom-color:#21699a;font-weight:600}
.cw-record-tabs button:disabled{cursor:wait}
.cw-email-drop{display:flex;flex-direction:column;align-items:center;gap:12px;border:1px dashed #a8bbc9;border-radius:6px;padding:24px 12px;background:#fafcfd;text-align:center;min-width:0}
.cw-email-dragging{border-color:#21699a;background:#eef7fc}
.cw-email-drop .cw-caption{white-space:normal;overflow-wrap:anywhere}
.cw-import-results{padding:0;margin:16px 0 0;list-style:none}
.cw-import-results li{display:grid;grid-template-columns:18px minmax(0,1fr) minmax(90px,auto);gap:10px;padding:10px 0;border-bottom:1px solid #e6edf2;align-items:start;font-size:13px}
.cw-import-results li span{overflow-wrap:anywhere}
.cw-import-failed{color:#b73838}
