/*!*************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./app/globals.css ***!
  \*************************************************************************************************************************************************************************************************************************************************************/
:root {
  /* ATT Light Blue Theme */
  --bg: #edf2f7;
  --panel: #ffffff;
  --panel-2: #f0f5fb;
  --border: #c3d3e8;
  --text: #0a1828;
  --muted: #4a6180;
  --primary: #0057b8;
  --primary-hover: #004393;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --sidebar-bg: #003f8a;
  --sidebar-text: #e8f0fc;
  --sidebar-active: #0057b8;
  --hover-bg: #dce9f8;
  --error: #dc2626;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  font: inherit;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}

label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

.field {
  margin-bottom: 12px;
}

.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 14px;
  font-weight: 600;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 5px 9px;
  font-size: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

.alert {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  color: #7f1d1d;
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid var(--success);
  color: #14532d;
}

.muted {
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.badge-owner {
  color: #fde68a;
  border-color: #f59e0b;
}
.badge-admin {
  color: #93c5fd;
  border-color: #3b82f6;
}
.badge-operator {
  color: #86efac;
  border-color: #22c55e;
}
.badge-viewer {
  color: var(--muted);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.spread {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Auth screens */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
}

/* Dashboard shell */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

.shell--collapsed {
  grid-template-columns: 64px 1fr;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  transition: padding 0.2s ease;
  color: var(--sidebar-text);
}

.sidebar--collapsed {
  padding: 12px 8px;
  align-items: center;
}

.sidebar .brand {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  color: #ffffff;
}

/* Collapse/expand toggle button */
.sidebar-toggle {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--sidebar-text);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
  cursor: pointer;
  align-self: flex-end;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.sidebar--collapsed .sidebar-toggle {
  align-self: center;
}

.sidebar-toggle:hover {
  background: rgba(255,255,255,0.22);
  color: #fff;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.15);
  margin: 4px 0;
  width: 100%;
}

/* Nav links with icon + label */
.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  min-height: 38px;
}

.sidebar--collapsed .nav-link {
  padding: 8px;
  justify-content: center;
  gap: 0;
}

.nav-icon {
  font-size: 17px;
  flex-shrink: 0;
  line-height: 1;
}

.nav-label {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link:hover {
  background: rgba(255,255,255,0.12);
  text-decoration: none;
}

.nav-link.active {
  background: rgba(255,255,255,0.22);
  color: #fff;
  font-weight: 600;
}

.main {
  display: flex;
  flex-direction: column;
}

.navbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--panel);
}

.content {
  padding: 24px;
  max-width: 1100px;
  width: 100%;
}

.ws-switcher {
  width: auto;
  min-width: 200px;
}

h1 {
  font-size: 22px;
  margin: 0 0 16px;
}
h2 {
  font-size: 17px;
  margin: 0 0 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ────────────────────────────────────────────────────────────────────────────
   Inbox / Chat layout
   ──────────────────────────────────────────────────────────────────────────── */

/* Full-height 2-column inbox layout */
.inbox-layout {
  display: flex;
  /* Escape .content padding (24px) and max-width */
  margin: -24px;
  height: calc(100vh - 56px);
  overflow: hidden;
  background: var(--bg);
  max-width: none;
}

/* Left sidebar: conversation list */
.inbox-sidebar {
  width: 300px;
  min-width: 220px;
  max-width: 340px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
}

.inbox-sidebar-header {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.inbox-back-link {
  font-size: 12px;
  color: var(--muted);
  display: inline-block;
  margin-bottom: 2px;
}

.inbox-back-link:hover {
  color: var(--text);
  text-decoration: none;
}

/* Right: message pane */
.inbox-main {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inbox-empty {
  flex: 1 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.inbox-thread-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.inbox-thread-name {
  font-weight: 700;
  font-size: 15px;
}

/* ── Conversation List ── */
.conv-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1 1;
}

.conv-list-search {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.conv-search-input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 20px;
  font-size: 13px;
}

.conv-list-items {
  overflow-y: auto;
  flex: 1 1;
}

.conv-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.1s;
}

.conv-item:hover {
  background: var(--panel-2);
}

.conv-item--active {
  background: rgba(59, 130, 246, 0.15);
  border-left: 3px solid var(--primary);
}

.conv-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--panel-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.conv-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.conv-avatar-initials {
  font-weight: 700;
  font-size: 16px;
  color: var(--muted);
}

.conv-group-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 4px;
}

.conv-item-body {
  flex: 1 1;
  min-width: 0;
}

.conv-item-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
}

.conv-item-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item-time {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

.conv-item-preview {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ── Message Thread ── */
.msg-thread {
  flex: 1 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.msg-thread--center {
  align-items: center;
  justify-content: center;
}

.msg-day-separator {
  text-align: center;
  margin: 12px 0 6px;
  position: relative;
}

.msg-day-separator span {
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Message row */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin-bottom: 4px;
}

.msg-row--out {
  flex-direction: row-reverse;
}

.msg-row--deleted {
  opacity: 0.72;
}

.msg-sender-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.msg-col {
  display: flex;
  flex-direction: column;
  max-width: 65%;
}

.msg-row--out .msg-col {
  align-items: flex-end;
}

.msg-sender-name {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
  margin-left: 4px;
}

.msg-bubble {
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  display: inline-block;
  max-width: 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.msg-bubble--in {
  background: var(--panel);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.msg-bubble--out {
  background: #0b64c4;   /* Zalo blue */
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-bubble--deleted {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  border-style: dashed !important;
  box-shadow: none;
}

.msg-deleted-badge-row {
  display: block;
}

.msg-state-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 2px 10px;
  border: 1px solid transparent;
}

.msg-state-badge-icon {
  line-height: 1;
  font-size: 12px;
}

.msg-state-badge--recalled {
  color: #8a6700;
  background: rgba(255, 224, 130, 0.28);
  border-color: rgba(255, 193, 7, 0.4);
}

.msg-state-badge--deleted {
  color: #8c1d18;
  background: rgba(255, 138, 128, 0.24);
  border-color: rgba(211, 47, 47, 0.35);
}

.msg-bubble--out .msg-state-badge--recalled,
.msg-bubble--out .msg-state-badge--deleted {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

.msg-deleted-text {
  font-style: italic;
  color: var(--muted);
  font-size: 12px;
  display: none;
}

.msg-media-label {
  color: var(--muted);
}

/* Zalo reaction badge (rType messages) */
.msg-reaction-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--muted);
}

.msg-bubble--out .msg-reaction-badge {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

.msg-reaction-icon {
  font-size: 18px;
  line-height: 1;
}

.msg-reaction-label {
  font-size: 12px;
}

/* Reaction pills attached to parent bubble */
.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
}
.msg-reactions--out {
  justify-content: flex-end;
}
.msg-reaction-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  transition: border-color 0.15s;
}
.msg-reaction-pill:hover {
  border-color: var(--primary);
}
.msg-reaction-pill--open {
  border-color: var(--primary);
  background: var(--panel-2);
}
.msg-reaction-pill-count {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.msg-reaction-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: none;
  min-width: 80px;
  text-align: center;
}

/* Quoted reply block */
.msg-reply-quote {
  display: block;
  border-left: 3px solid var(--primary);
  padding: 4px 8px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(0, 87, 184, 0.06);
  border-radius: 0 6px 6px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-bubble--out .msg-reply-quote {
  border-left-color: rgba(255, 255, 255, 0.6);
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.12);
}

.msg-time {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  padding: 0 4px;
}

/* ── Message Input Bar ── */
.msg-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
  align-items: flex-end;
}

.msg-input-textarea {
  flex: 1 1;
  resize: none;
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  min-height: 42px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.4;
}

.msg-send-btn {
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 14px;
  white-space: nowrap;
}

/* ── Mail Merge Wizard ──────────────────────────────────────────────────────── */

.mm-wizard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  max-width: 1100px;
}

.mm-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.mm-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.mm-step.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

.mm-step.done {
  background: #e8f5e9;
  border-color: #a5d6a7;
  color: #2e7d32;
}

.mm-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.mm-step.active .mm-step-num { background: rgba(255,255,255,0.3); }
.mm-step.done .mm-step-num { background: #a5d6a7; }

.mm-step-body { display: flex; flex-direction: column; gap: 16px; }

.mm-row { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 24px; gap: 24px; }
@media (max-width: 768px) { .mm-row { grid-template-columns: 1fr; } }

.mm-col { display: flex; flex-direction: column; gap: 12px; }

.mm-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.mm-dropzone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  transition: border-color 0.15s, background 0.15s;
}

.mm-dropzone:hover, .mm-dropzone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.04);
}

.mm-dropzone.has-file {
  border-style: solid;
  border-color: #a5d6a7;
  background: #f1f8f1;
}

.mm-drop-icon { font-size: 32px; margin-bottom: 8px; }
.mm-file-ok { font-weight: 600; color: #2e7d32; font-size: 14px; margin-bottom: 4px; }
.mm-file-info { font-size: 12px; color: var(--muted); }
.mm-file-change { font-size: 11px; color: var(--primary); margin-top: 6px; }

.mm-field { display: flex; flex-direction: column; gap: 4px; }
.mm-field-sm { flex: 1 1; }
.mm-delay-row { display: flex; gap: 12px; }

.mm-label { font-size: 12px; font-weight: 500; color: var(--muted); }

.mm-input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}

.mm-input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

.mm-textarea {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
  line-height: 1.5;
}

.mm-textarea:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

.mm-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mm-chips-label { font-size: 12px; color: var(--muted); }

.mm-chip {
  padding: 3px 8px;
  background: #ede9fe;
  color: var(--primary);
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-family: monospace;
}

.mm-chip:hover { background: #ddd6fe; }

.mm-live-preview { display: flex; flex-direction: column; gap: 8px; }

.mm-preview-bubble {
  background: #f0f4ff;
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  padding: 8px 12px;
}

.mm-preview-phone { font-size: 11px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }

.mm-preview-text {
  font-family: inherit;
  font-size: 13px;
  white-space: pre-wrap;
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.mm-preview-text-sm {
  font-family: inherit;
  font-size: 12px;
  white-space: pre-wrap;
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  max-height: 320px;
  overflow-y: auto;
}

.mm-error {
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  color: #991b1b;
  font-size: 13px;
}

.mm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.mm-preview-note {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
}

.mm-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.mm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.mm-table th {
  background: var(--bg);
  padding: 8px 12px;
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.mm-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.mm-table tr:last-child td { border-bottom: none; }
.mm-table tr:hover td { background: var(--hover); }

.badge-ok { background: #d1fae5; color: #065f46; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-sent { background: #d1fae5; color: #065f46; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-pending { background: #f3f4f6; color: var(--muted); }
.badge-skipped { background: #f3f4f6; color: var(--muted); }

.mm-progress-info {
  display: flex;
  gap: 20px;
  font-size: 14px;
  font-weight: 500;
  align-items: center;
}

.mm-progress-bar-wrap {
  height: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.mm-progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.5s ease;
  border-radius: 6px;
}

.mm-status {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.mm-status-running { background: #dbeafe; color: #1e40af; }
.mm-status-paused  { background: #fef3c7; color: #92400e; }
.mm-status-done    { background: #d1fae5; color: #065f46; }
.mm-status-error   { background: #fee2e2; color: #991b1b; }
.mm-status-draft   { background: #f3f4f6; color: var(--muted); }

.mm-loading { color: var(--muted); font-size: 14px; padding: 20px 0; text-align: center; }


/* ── Template selector UI ─────────────────────────────────────────────────── */
.mm-template-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.mm-template-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 5px;
  cursor: pointer;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}
.btn-xs:hover { background: var(--hover-bg); }
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.mm-template-picker {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mm-template-empty { color: var(--muted); font-size: 13px; padding: 8px 0; text-align: center; }
.mm-template-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}
.mm-template-card:hover { background: var(--hover-bg); }
.mm-template-name {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  flex: 1 1;
  padding: 0;
}
.mm-template-name:hover { text-decoration: underline; }
.mm-template-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  padding: 0 4px;
  line-height: 1;
}
.mm-template-del:hover { color: var(--danger); }
.mm-save-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.mm-save-form .mm-input {
  flex: 1 1;
}

/* ── Account banner + column selector ─────────────────────────────────────── */
.mm-account-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.mm-account-icon { font-size: 18px; }
.mm-account-label { opacity: 0.85; }
.mm-account-name { font-size: 15px; }
.mm-account-hint { opacity: 0.65; font-size: 12px; margin-left: 4px; }

.mm-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.mm-select:focus { outline: none; border-color: var(--primary); }

.mm-warn {
  margin-top: 4px;
  font-size: 12px;
  color: var(--warning);
}

/* ── Mail Merge: Column mapping inspector ────────────────────────────────── */
.mm-mapping {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.mm-mapping-title {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.mm-mapping-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.mm-mapping-table th {
  padding: 6px 12px;
  text-align: left;
  color: var(--muted);
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.mm-mapping-table td {
  padding: 5px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.mm-mapping-table tr:last-child td { border-bottom: none; }
.mm-mapping-table code {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 11px;
  font-family: monospace;
}
.mm-mapping-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.mm-mapping-badge--exact     { background: #d1fae5; color: #065f46; }
.mm-mapping-badge--normalized { background: #dbeafe; color: #1e40af; }
.mm-mapping-badge--partial    { background: #fef9c3; color: #713f12; }
.mm-mapping-badge--missing    { background: #fee2e2; color: #991b1b; }

/* ── Mail Merge Step 2 selection toolbar ─────────────────────────────────── */
.mm-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.mm-selection-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mm-selection-count {
  font-size: 13px;
  color: var(--muted);
  margin-right: 4px;
}
.mm-row-deselected td {
  opacity: 0.4;
}
.mm-table tbody tr:hover {
  background: var(--hover-bg);
}

/* ── Inbox page with tab bar ─────────────────────────────────────────────── */
.inbox-page {
  display: flex;
  flex-direction: column;
  margin: -24px;
  height: calc(100vh - 56px);
  overflow: hidden;
  background: var(--bg);
  max-width: none;
}
.inbox-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 12px 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tab-btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: color 0.15s, background 0.15s;
}
.tab-btn:hover { color: var(--text); background: var(--hover-bg); }
.tab-btn.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  background: transparent;
}
.inbox-session-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 12px 0;
  flex-shrink: 0;
}
.inbox-session-banner .btn { white-space: nowrap; flex-shrink: 0; }
/* Inbox tab content: reuse inbox-layout styles but scoped inside inbox-page */
.inbox-page .inbox-layout {
  margin: 0;
  flex: 1 1;
  height: unset;
  overflow: hidden;
}
.inbox-merge-tab {
  flex: 1 1;
  overflow-y: auto;
  padding: 24px;
}

/* ── Sidebar account context label ──────────────────────────────────────── */
.sidebar-account-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 4px 16px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  opacity: 0.9;
}
.sidebar-account-icon { font-size: 14px; }
.sidebar-account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}

/* ── Navbar channel selector ─────────────────────────────────────────────── */
.navbar-sep {
  color: var(--muted);
  font-size: 18px;
  padding: 0 4px;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}
.ws-switcher--channel {
  max-width: 220px;
}

/* ── Message media rendering ────────────────────────────────────────────── */
.msg-img {
  max-width: 280px;
  max-height: 220px;
  border-radius: 8px;
  display: block;
  cursor: pointer;
  object-fit: cover;
}
.msg-img--thumb {
  max-width: 220px;
  max-height: 160px;
}
.msg-img--clickable { cursor: zoom-in; }
.msg-video-thumb {
  position: relative;
  display: inline-block;
  cursor: pointer;
  padding: 0;
  border: none;
  background: none;
}
.msg-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
  pointer-events: none;
}

/* \u2500\u2500 Media lightbox (image/video/gif) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
  padding: 24px;
}
.media-lightbox-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 92vw;
  max-height: 88vh;
}
.media-lightbox-content {
  max-width: 92vw;
  max-height: 80vh;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.media-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}
.media-lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }
.media-lightbox-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  font-size: 14px;
  text-decoration: none;
}
.media-lightbox-download:hover { opacity: 0.9; }
.msg-sticker {
  width: 96px;
  height: 96px;
  object-fit: contain;
}
.msg-audio {
  max-width: 260px;
  height: 36px;
  border-radius: 20px;
}
.msg-file-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--hover-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--primary);
  font-size: 13px;
  text-decoration: none;
  word-break: break-all;
}
.msg-file-link:hover { background: var(--panel); }
.msg-link-card {
  padding: 8px 12px;
  background: var(--hover-bg);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  font-size: 13px;
  max-width: 260px;
}
.msg-link-card a { color: var(--primary); text-decoration: none; }
.msg-link-card a:hover { text-decoration: underline; }
.msg-reaction-emoji {
  font-size: 22px;
  line-height: 1.2;
}

