.commercial-message-page { max-width: 1180px; margin: 0 auto; }
.commercial-message-intro, .commercial-editor-head, .commercial-image-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.commercial-message-intro h2, .commercial-editor-head h2 { margin: 0 0 5px; }
.commercial-message-intro p, .commercial-editor-head p { margin: 0; }
.commercial-message-layout { display: grid; grid-template-columns: minmax(240px, .42fr) minmax(0, 1fr); gap: 18px; margin-top: 20px; align-items: start; }
.commercial-business-list, .commercial-message-editor { border: 1px solid #dbe1ea; border-radius: 16px; background: #fff; padding: 16px; }
.commercial-business-list { display: grid; gap: 8px; align-content: start; }
.commercial-business-list h3 { margin: 0 0 6px; }
.commercial-business { width: 100%; border: 1px solid #e2e8f0; border-radius: 13px; background: #fff; padding: 10px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; text-align: right; align-items: center; cursor: pointer; color: inherit; }
.commercial-business:hover, .commercial-business.active { border-color: #818cf8; background: #eef2ff; }
.commercial-business > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.commercial-business strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.commercial-business small { color: var(--muted); font-size: 11px; }
.commercial-business-icon { display: grid; place-items: center; width: 31px; height: 31px; color: #fff; font-weight: 900; border-radius: 10px; background: linear-gradient(135deg,#7c3aed,#4f46e5); }
.commercial-business em { font-size: 10px; font-style: normal; font-weight: 800; white-space: nowrap; padding: 3px 6px; border-radius: 999px; background: #f1f5f9; color: #64748b; }
.commercial-business em.on { background: #dcfce7; color: #15803d; }
.commercial-business em.off { background: #fef3c7; color: #a16207; }
.commercial-message-editor { display: grid; gap: 13px; }
.commercial-template-manager, .commercial-schedule-templates { display: grid; gap: 10px; padding: 13px; border: 1px solid #dbe4ff; border-radius: 13px; background: #f8faff; }
.commercial-template-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.commercial-template-head > div, .commercial-schedule-templates > div { display: grid; gap: 3px; }
.commercial-template-head small, .commercial-schedule-templates small { color: var(--muted); font-size: 12px; }
.commercial-template-tabs { display: flex; flex-wrap: wrap; gap: 7px; }
.commercial-template-tab { border: 1px solid #c7d2fe; border-radius: 999px; background: #fff; color: #334155; padding: 7px 11px; font: inherit; font-size: 12px; cursor: pointer; }
.commercial-template-tab.active { background: #4f46e5; border-color: #4f46e5; color: #fff; font-weight: 700; }
.commercial-schedule-template { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid #dbe4ff; }
.commercial-schedule-template:first-of-type { border-top: 0; }
.commercial-schedule-template > span { display: grid; gap: 3px; min-width: 0; }
.commercial-schedule-template select { width: min(220px, 48%); min-height: 38px; }
.commercial-enabled { display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 11px; white-space: nowrap; font-weight: 700; }
.commercial-enabled input { width: auto; }
.commercial-package-summary { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; padding: 11px; background: #f8fafc; border-radius: 12px; font-size: 12px; }
.commercial-package-summary strong { margin-inline-end: 4px; }
.commercial-package-summary span { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 5px 7px; }
.commercial-message-editor textarea { width: 100%; box-sizing: border-box; min-height: 170px; resize: vertical; font: inherit; line-height: 1.7; padding: 14px; border: 1px solid #dbe1ea; border-radius: 12px; }
.commercial-message-editor fieldset { border: 1px solid #dbe1ea; border-radius: 12px; padding: 12px; max-height: 260px; overflow: auto; }
.commercial-image-actions { justify-content: flex-start; }
.commercial-image-actions small { color: var(--muted); }
.commercial-message-preview { overflow: hidden; border: 1px solid #dce8dc; border-radius: 14px; background: #f7fbf7; }
.commercial-preview-label { padding: 9px 13px; border-bottom: 1px solid #dce8dc; background: #fff; color: #58705a; font-size: 12px; font-weight: 800; }
.commercial-preview-chat { min-height: 116px; padding: 18px; background-color: #e8eee6; background-image: radial-gradient(#d2ddd080 1px, transparent 1px); background-size: 14px 14px; }
.commercial-preview-bubble { position: relative; max-width: min(100%, 620px); margin-inline-start: auto; padding: 9px 12px 21px; border-radius: 10px 2px 10px 10px; background: #dcf8c6; color: #172b1a; box-shadow: 0 1px 1px #0002; line-height: 1.6; white-space: pre-wrap; unicode-bidi: plaintext; overflow-wrap: anywhere; }
.commercial-preview-bubble img { display: block; width: 100%; max-height: 360px; margin-bottom: 8px; object-fit: contain; border-radius: 7px; background: #cbd5d0; }
.commercial-preview-bubble img[hidden] { display: none; }
.commercial-preview-bubble video { display: block; width: 100%; max-height: 360px; margin-bottom: 8px; border-radius: 7px; background: #111; }
.commercial-preview-bubble video[hidden] { display: none; }
.commercial-preview-bubble time { position: absolute; bottom: 4px; inset-inline-end: 9px; color: #66815f; font-size: 10px; white-space: nowrap; }
.commercial-message-empty { padding: 72px 20px; text-align: center; color: var(--muted); }
.commercial-message-empty span { display: block; font-size: 42px; }
.commercial-message-empty h3 { margin: 10px 0 5px; color: var(--text); }
@media (max-width: 760px) {
  .commercial-message-layout { grid-template-columns: 1fr; }
  .commercial-message-intro, .commercial-editor-head { align-items: flex-start; flex-direction: column; }
  .commercial-enabled { width: 100%; box-sizing: border-box; }
}
@media (max-width: 520px) {
  .commercial-template-head, .commercial-schedule-template { align-items: stretch; flex-direction: column; }
  .commercial-template-head .btn, .commercial-schedule-template select { width: 100%; }
}
.commercial-emoji-trigger { width: fit-content; }
.commercial-emoji-popover { position: fixed; z-index: 1000; width: min(430px, calc(100vw - 24px)); border: 1px solid #d6e0ed; border-radius: 16px; padding: 14px; background: #fff; box-shadow: 0 18px 42px #10233c33; }
.commercial-emoji-dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.commercial-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.commercial-emoji-grid button { border: 1px solid var(--border, #d9e1ec); background: #fff; border-radius: 9px; padding: 8px 2px; font-size: 21px; cursor: pointer; }
.commercial-emoji-grid button:hover { background: #eef5ff; border-color: #8ab6eb; }
