/* Responsive unified inbox, isolated from the other workspace screens. */
.colmena-chat .bubble{white-space:normal!important}.message-text{white-space:pre-wrap;overflow-wrap:anywhere}
.colmena-chat .chat-head .switch input{appearance:none;width:30px;height:18px;padding:0;background:#373126;border:1px solid #746447;border-radius:20px;position:relative;cursor:pointer;flex:none;transition:background .2s}
.colmena-chat .chat-head .switch input:before{content:'';position:absolute;width:12px;height:12px;left:2px;top:2px;background:#b7ab91;border-radius:50%;transition:transform .2s}
.colmena-chat .chat-head .switch input:checked{background:#f0b429;border-color:#f0b429}.colmena-chat .chat-head .switch input:checked:before{transform:translateX(12px);background:#211a0a}
[data-page="chats"]{display:flex;flex-direction:column;min-height:0}
[data-page="chats"] .page-heading{margin-bottom:20px}
[data-page="chats"] h1{font-size:38px}
.inbox-toolbar{margin-bottom:18px;display:flex;justify-content:space-between;align-items:center}
.inbox-counter{font-family:'JetBrains Mono',monospace;font-size:10px;color:#8a8172;white-space:nowrap}
.colmena-chat{grid-template-columns:310px minmax(0,1fr);height:calc(100dvh - 288px);min-height:510px;max-height:900px;background:#0d0d0c;border-radius:16px}
.colmena-chat .threads{min-height:0;padding:20px 12px 10px;background:#11110f;overflow:hidden}
.threads-heading{display:flex;align-items:center;justify-content:space-between;padding:0 8px;margin-bottom:20px}
.threads-heading h2{font-size:15px;margin-top:8px}.threads-heading h2 span{font-family:'JetBrains Mono',monospace;font-size:10px;padding:3px 6px;border-radius:5px;border:1px solid #f0b42930;color:#f0b429;margin-left:7px}
.threads-heading>.icon{color:#8a7860}.colmena-chat .search{padding:12px 13px;min-height:42px;background:#1a1814;border-color:#ffffff0d;border-radius:9px;font-size:11px}
.colmena-chat .thread-list{min-height:0;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#3a3222 transparent}
.colmena-chat .thread{align-items:center;border-radius:10px;padding:16px 10px;margin-bottom:4px;min-height:96px;gap:12px;border:1px solid transparent;position:relative}
.colmena-chat .thread.active{border-color:#f0b42938;background:#f0b42909}.colmena-chat .thread.active:before{content:'';position:absolute;left:-1px;top:20px;bottom:20px;width:3px;background:#f0b429;border-radius:3px}
.colmena-chat .thread strong{font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:160px}.colmena-chat .thread p{font-size:11px;max-width:190px;margin:6px 0;color:#8b8476;line-height:1.6}.colmena-chat .thread time{font-size:8px;color:#786e5b}
.thread-avatar{position:relative;flex-shrink:0}.thread-avatar>.avatar{width:39px;height:39px;font-size:11px;background:#27231a;border:1px solid #b8954d20;color:#dfca9d}
.thread-channel{position:absolute;bottom:-3px;right:-3px;width:17px;height:17px;border-radius:50%;background:#151411;border:2px solid #11110f;display:grid;place-items:center;color:#b2a17e}.thread-channel svg{height:12px;width:12px}.thread-channel.whatsapp{color:#25d366}.thread-channel.telegram{color:#2aabee}.thread-channel.instagram{color:#ee2a7b}.thread-meta{font-size:9px;color:#a19781;display:flex;gap:6px}.thread-meta i{font-style:normal;color:#584c36}
.colmena-chat .conversation{position:relative;min-height:0;background:#0c0c0b;overflow:hidden}
.colmena-chat .chat-head{padding:17px 23px;min-height:83px;flex:none;background:#12120f;gap:10px}.colmena-chat .chat-head>.person{min-width:0;flex:1}.colmena-chat .chat-head .person>div:last-child{min-width:0}.colmena-chat .chat-head .person>div>div{flex-wrap:wrap;gap:5px!important}.chat-contact-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:260px}
.colmena-chat .chat-head small{color:#9b927f;font-size:10px;margin-top:5px}.colmena-chat .chat-head small span{margin:0 5px;color:#615944}.colmena-chat .wa-link{font-size:9px;color:#8eab89;opacity:.9}.colmena-chat .wa-link .icon{width:12px;height:12px}.colmena-chat .chat-head .switch{font-size:10px;gap:7px;white-space:nowrap}.contact-info-button{width:34px;min-height:34px;padding:7px;color:#b1a48b;border-color:#ffffff12;background:#ffffff03}
.chat-back{display:none;min-height:35px;width:35px;padding:7px;flex:none}.chat-back .icon{transform:rotate(180deg)}
.colmena-chat .messages{min-height:0;max-height:none;flex:1;padding:22px 28px;gap:17px;overflow-x:hidden;overscroll-behavior:contain;background:radial-gradient(ellipse at 70% 30%,#f0b42903,transparent 75%);scrollbar-width:thin;scrollbar-color:#3a3222 transparent}
.chat-history-label{display:flex;align-items:center;gap:15px;justify-content:center;color:#6e6554;font-family:'JetBrains Mono',monospace;font-size:8px;margin:0 0 12px;flex:none}.chat-history-label:before,.chat-history-label:after{content:'';height:1px;flex:1;background:#ffffff08}
.colmena-chat .bubble{max-width:77%;padding:12px 15px;border:1px solid #ffffff0a;background:#1b1b17;border-radius:12px 12px 12px 3px;color:#dfdbce;font-size:12px;font-weight:400;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere;flex-shrink:0}
.colmena-chat .bubble.out{align-self:flex-end;background:#302719;border:1px solid #e4b44620;border-radius:12px 12px 3px 12px;color:#f1dfb9}.colmena-chat .bubble.human{background:#1d2a23;border-color:#79ba8c22;color:#d5e7d6}.colmena-chat .message-time{font-size:8px;color:#817763;line-height:1.5;margin-top:8px;text-align:right}.colmena-chat .bubble.out .message-time{color:#b29a6c}.colmena-chat .bubble.human .message-time{color:#89a68b}
.colmena-chat .ai-notice{padding:9px 18px;text-align:center;background:#f0b42904;border-block:1px solid #f0b4290d;color:#a79570;font-family:'JetBrains Mono',monospace;font-size:9px;flex:none}
.colmena-chat .chat-suggestions{display:flex;gap:6px;padding:11px 18px 0;overflow-x:auto;flex-wrap:nowrap;flex:none;scrollbar-width:none;background:#11110f}.colmena-chat .suggestion-chip{white-space:nowrap;font-size:10px;padding:6px 10px;min-height:29px;flex:none;background:#ffffff03;border-color:#ffffff12;border-radius:7px}
.colmena-chat .chat-compose{background:#11110f;padding:12px 18px 10px;flex:none;border:0}.colmena-chat .compose-box{display:flex;align-items:flex-end;gap:8px;padding:7px;background:#191813;border:1px solid #ffffff16;border-radius:12px}.colmena-chat .compose-box:focus-within{border-color:#f0b42960;box-shadow:0 0 0 3px #f0b42906}
.colmena-chat #chat-input{flex:1;min-width:0;min-height:36px;max-height:120px;height:36px;padding:8px 4px;resize:none;background:transparent;border:0;box-shadow:none;font-size:12px;line-height:20px;color:#eee4d1;outline:none}.colmena-chat .compose-box>button{width:36px;min-height:36px;padding:7px;flex:none;border-radius:8px}.colmena-chat .compose-box>button:first-child{border-color:transparent;background:none;color:#a69b85;font-size:22px}
.compose-hint{display:block;text-align:center;color:#716653;font-size:8px;padding-top:7px;font-family:'JetBrains Mono',monospace}.compose-hint span{padding:0 5px}
.chat-details-panel{position:absolute;inset:0 0 0 auto;width:290px;background:#151410;border-left:1px solid #f0b42930;box-shadow:-20px 0 50px #0007;z-index:5;padding:22px;overflow:auto}.chat-details-panel .section-head{margin-bottom:24px}.chat-details-panel .section-head button{width:30px;min-height:30px;padding:5px}.chat-details-panel>.avatar{margin-bottom:15px;width:48px;height:48px}.chat-details-panel h2{font-size:18px}.chat-details-panel dl{margin:25px 0}.chat-details-panel dt{font-family:'JetBrains Mono',monospace;font-size:9px;color:#8a7c62;margin-top:20px}.chat-details-panel dd{font-size:12px;color:#d2c5ac;margin:6px 0;overflow-wrap:anywhere;line-height:1.8}
@media(min-width:1500px){.colmena-chat{grid-template-columns:340px minmax(0,1fr)}.colmena-chat .thread strong{max-width:185px}.colmena-chat .thread p{max-width:215px}}
@media(max-width:1150px) and (min-width:901px){.colmena-chat{grid-template-columns:265px minmax(0,1fr)}.colmena-chat .chat-head{padding:14px}.colmena-chat .wa-link{display:none}.colmena-chat .thread strong{max-width:125px}.colmena-chat .thread p{max-width:155px}.colmena-chat .chat-head .switch span{font-size:9px}.colmena-chat .messages{padding:20px}.colmena-chat .chat-head>.person .avatar{display:none}}
@media(max-width:900px){[data-page="chats"]{padding-bottom:14px}[data-page="chats"] h1{font-size:32px}.inbox-toolbar{margin-bottom:12px}.inbox-toolbar>div:last-child{display:none}.inbox-toolbar>.tabs{width:100%}.colmena-chat{display:block;height:calc(100dvh - 260px);min-height:420px;max-height:none}.colmena-chat .threads{height:100%;border:0;padding:20px 12px 10px;max-height:none}.colmena-chat .conversation{display:none;height:100%}.colmena-chat.mobile-conversation .threads{display:none}.colmena-chat.mobile-conversation .conversation{display:flex}.colmena-chat.mobile-conversation .chat-back{display:inline-flex}.colmena-chat .thread strong{max-width:none}.colmena-chat .thread p{max-width:none}.colmena-chat .chat-head{padding:12px;min-height:76px}.colmena-chat .chat-head .person .avatar{display:none}.chat-contact-name{max-width:190px}.colmena-chat .wa-link{display:none}.colmena-chat .chat-head>div:last-child{gap:8px!important}.colmena-chat .chat-head .switch span{font-size:9px}.colmena-chat .messages{padding:18px 14px}.colmena-chat .bubble{max-width:85%;font-size:12px}.colmena-chat .chat-suggestions{padding:9px 10px 0}.colmena-chat .chat-compose{padding:10px 10px calc(10px + env(safe-area-inset-bottom))}.compose-hint{display:none}.colmena-chat .ai-notice{font-size:8px;padding:8px 10px}.chat-details-panel{width:min(310px,100%)}.threads-heading h2{font-size:17px}}
@media(max-width:480px){[data-page="chats"]{padding:20px 12px 12px}[data-page="chats"] .page-heading{margin-bottom:14px}[data-page="chats"] .page-heading p{display:none}[data-page="chats"] .eyebrow{font-size:9px;margin-bottom:8px}[data-page="chats"] h1{font-size:28px;margin-bottom:6px}.colmena-chat{height:calc(100dvh - 225px);min-height:370px;border-radius:12px}.inbox-toolbar .tabs button{padding:7px 10px;font-size:9px}.colmena-chat .chat-head .switch{gap:5px}.colmena-chat .chat-head .switch input{transform:scale(.85)}.chat-contact-name{font-size:11px!important;max-width:120px}.colmena-chat .chat-head small{font-size:9px}.colmena-chat .chat-head{gap:7px}.contact-info-button{width:30px;min-height:30px;padding:6px}.colmena-chat .thread{min-height:95px}}


/* Adjuntos en el chat (Fase 2) */
.attachment-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a1814;
  border: 1px solid #f0b42940;
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  gap: 10px;
}
.attachment-preview-bar .preview-content {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.attachment-preview-bar .preview-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #332d20;
}
.attachment-preview-bar .preview-icon {
  font-size: 20px;
  line-height: 1;
}
.attachment-preview-bar .preview-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.attachment-preview-bar .preview-name {
  font-size: 11px;
  color: #eee4d1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-preview-bar .preview-size {
  font-size: 9px;
  color: #8b8476;
  font-family: 'JetBrains Mono', monospace;
}
.attachment-preview-bar .preview-remove {
  background: transparent;
  border: none;
  color: #a69b85;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.attachment-preview-bar .preview-remove:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
}

.message-media-attachment {
  margin-bottom: 6px;
}
.chat-bubble-image {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  display: block;
  object-fit: cover;
  cursor: pointer;
  transition: opacity .15s ease;
}
.chat-bubble-image:hover {
  opacity: 0.9;
}

.message-doc-attachment {
  margin-bottom: 6px;
}
.doc-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 12px;
  color: inherit;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.doc-card:hover {
  background: rgba(240, 180, 41, 0.08);
  border-color: rgba(240, 180, 41, 0.35);
}
.doc-card-icon {
  font-size: 22px;
  line-height: 1;
  flex: none;
}
.doc-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.doc-card-name {
  font-size: 12px;
  font-weight: 500;
  color: #f7ecd7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-card-size {
  font-size: 9px;
  color: #8b8476;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}
.doc-card-action {
  color: #f0b429;
  flex: none;
  display: flex;
  align-items: center;
}
