/* Centro Messaggi — WhatsApp Web layout */
.mc-wrap {
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
}
.mc-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--c-surface);
  box-shadow: var(--shadow-soft);
}
.mc-layout > .mc-sidebar,
.mc-layout > .mc-main {
  min-height: 0;
  overflow: hidden;
}
.mc-sidebar {
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  background: var(--c-surface-2);
}
.mc-sidebar-head { padding: 14px 16px; border-bottom: 1px solid var(--c-border); }
.mc-title { margin: 0 0 10px; font-size: 17px; font-weight: 600; }
.mc-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  border-radius: 20px;
  background: var(--c-surface);
  font-size: 13px;
}
.mc-conv-list { flex: 1; overflow-y: auto; min-height: 0; }
.mc-conv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--c-border);
  transition: background 0.15s;
}
.mc-conv-row:hover, .mc-conv-row.active { background: var(--c-accent-soft); }
.mc-conv-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--c-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; flex-shrink: 0;
}
.mc-conv-body { flex: 1; min-width: 0; }
.mc-conv-top { display: flex; justify-content: space-between; gap: 8px; }
.mc-conv-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-conv-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.mc-badge {
  background: var(--c-success); color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; padding: 0 6px;
}
.mc-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #e8ebe9;
}
.mc-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.mc-chat-full {
  flex: 1;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.mc-chat-header {
  flex-shrink: 0;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 12px 16px;
}
.mc-chat-header-inner { display: flex; align-items: center; gap: 12px; }
.mc-chat-title { font-weight: 600; font-size: 15px; }
.mc-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h60v60H0z' fill='%23e8ebe9'/%3E%3Cpath d='M0 30h60M30 0v60' stroke='%23dfe3e0' stroke-width='0.5'/%3E%3C/svg%3E");
}
.mc-bubble-row { display: flex; }
.mc-bubble-row.mc-in { justify-content: flex-start; }
.mc-bubble-row.mc-out { justify-content: flex-end; }
.mc-bubble {
  max-width: min(75%, 520px);
  padding: 8px 12px 6px;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
  font-size: 14px;
  line-height: 1.45;
}
.mc-in .mc-bubble { background: #fff; border-top-left-radius: 0; }
.mc-out .mc-bubble { background: #d9fdd3; border-top-right-radius: 0; }
.mc-bubble-sender { font-size: 12px; font-weight: 600; color: var(--c-accent); margin-bottom: 4px; }
.mc-bubble-time { font-size: 10px; color: var(--c-text-soft); text-align: right; margin-top: 4px; }
.mc-read { color: #53bdeb; margin-left: 4px; }
.mc-typing { flex-shrink: 0; padding: 4px 16px; font-style: italic; min-height: 20px; }
.mc-attachment { display: block; font-size: 12px; margin-top: 6px; color: var(--c-accent); }
.mc-composer {
  flex-shrink: 0;
  background: var(--c-surface-2);
  border-top: 1px solid var(--c-border);
  padding: 10px 16px;
}
.mc-composer-row { display: flex; align-items: flex-end; gap: 8px; }
.mc-input {
  flex: 1;
  resize: none;
  border: none;
  border-radius: 20px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  max-height: 120px;
  min-height: 40px;
  background: #fff;
}
.mc-send-btn { border-radius: 20px; padding: 8px 18px; }
.mc-attach-btn { border-radius: 50%; width: 36px; height: 36px; padding: 0; }
.mc-empty-chat, .mc-loading { text-align: center; color: var(--c-text-muted); padding: 40px 20px; }

/* Archivi admin */
.mc-archives-wrap { max-width: 1100px; padding: 8px 4px 24px; }
.mc-archives-head { margin-bottom: 16px; }
.mc-archives-head .mc-title { margin: 0 0 6px; font-size: 20px; }
.mc-archives-toolbar { margin-bottom: 16px; }
.mc-archives-actions { display: flex; flex-direction: column; gap: 14px; }
.mc-archives-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mc-archives-period { padding: 8px 10px; border: 1px solid var(--c-border); border-radius: var(--r-md); }
.mc-purge-row { border-top: 1px solid var(--c-border); padding-top: 12px; }
.mc-purge-label { font-size: 13px; cursor: pointer; }
.mc-purge-confirm { max-width: 160px; padding: 6px 10px; border: 1px solid var(--c-warn); border-radius: var(--r-md); }
.mc-archives-table { width: 100%; }
.table-scroll { overflow-x: auto; }

.mc-notify-wrap { max-width: 640px; padding: 8px 4px 24px; }
.mc-notify-body { display: flex; flex-direction: column; gap: 14px; }
.mc-notify-row { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.mc-notify-hint { margin-top: 8px; }

@media (max-width: 900px) {
  .mc-layout { grid-template-columns: 1fr; }
  .mc-sidebar { max-height: 40vh; }
}
