/* support.css — styles for the CRM support add-on (crm_plus).
   Reuses the host app's CSS variables (--green, --line, --bg, etc.). */

.sup-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 16px 0; border-bottom: 1px solid var(--line, #e4e7e4); }
.sup-tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font: inherit; color: var(--muted, #667); border-bottom: 2px solid transparent; }
.sup-tabs button.active { color: var(--ink, #1a1f1a); border-bottom-color: var(--green, #2e7d54); font-weight: 600; }

.sup-body { margin-top: 8px; }
.sup-muted { color: var(--muted, #78807a); font-size: 13px; }
.sup-link { border: 0; background: none; color: var(--green, #2e7d54); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.sup-role select { margin-left: 6px; padding: 6px 8px; border: 1px solid var(--line, #d9ded9); border-radius: 8px; font: inherit; }

.sup-filterbar { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.sup-filterbar button { border: 1px solid var(--line, #d9ded9); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; font-size: 13px; }
.sup-filterbar button.active { background: var(--green, #2e7d54); color: #fff; border-color: var(--green, #2e7d54); }

.sup-tablewrap { overflow-x: auto; margin-top: 12px; }
.sup-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sup-table th, .sup-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line, #eef0ee); vertical-align: top; }
.sup-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #78807a); }
.sup-table td.red { color: #c0392b; font-weight: 600; }
.sup-table td.amber { color: #b7791f; }
.sup-table svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 4px; }
.sup-table.sm td { padding: 4px 8px; font-size: 13px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; background: #eef1ee; font-size: 12px; font-weight: 600; }
.pill.green { background: #dff2e6; color: #1f7a48; }
.pill.amber { background: #fdf0d5; color: #92600b; }
.pill.red { background: #fbe0dd; color: #b02a1c; }
.pill.blue { background: #e0ebfb; color: #24558f; }

.sup-client { border: 0; background: none; cursor: pointer; font: inherit; color: var(--ink, #1a1f1a); font-weight: 600; text-decoration: underline dotted; padding: 0; }
.sup-client:hover, .sup-client:focus { color: var(--green, #2e7d54); }

/* Chats */
.sup-chatgrid { display: grid; grid-template-columns: 240px 1fr 300px; gap: 14px; margin-top: 12px; }
.sup-chatlist { display: flex; flex-direction: column; gap: 6px; }
.sup-chatitem { text-align: left; border: 1px solid var(--line, #e4e7e4); border-radius: 10px; background: #fff; padding: 10px; cursor: pointer; font: inherit; }
.sup-chatitem.active { border-color: var(--green, #2e7d54); box-shadow: 0 0 0 1px var(--green, #2e7d54) inset; }
.sup-chatitem-top { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 3px; }
.sup-conv { border: 1px solid var(--line, #e4e7e4); border-radius: 12px; display: flex; flex-direction: column; min-height: 320px; }
.sup-conv-head { padding: 12px 14px; border-bottom: 1px solid var(--line, #eef0ee); display: flex; justify-content: space-between; align-items: center; }
.sup-msgs { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.sup-msg { max-width: 78%; }
.sup-msg.client { align-self: flex-start; }
.sup-msg.agent, .sup-msg.system { align-self: flex-end; text-align: right; }
.sup-msg-body { padding: 8px 12px; border-radius: 12px; background: #f1f4f1; display: inline-block; }
.sup-msg.agent .sup-msg-body { background: #dff2e6; }
.sup-msg-meta { font-size: 11px; color: var(--muted, #98a09a); margin-top: 2px; }
.sup-composer, .sup-csat { padding: 12px 14px; border-top: 1px solid var(--line, #eef0ee); display: flex; gap: 8px; align-items: center; }
.sup-ctx { display: flex; flex-direction: column; gap: 14px; }
.sup-ctx section { border: 1px solid var(--line, #e4e7e4); border-radius: 10px; padding: 12px; }
.sup-ctx-h { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #78807a); margin-bottom: 6px; }
.sup-sim { padding: 8px 0; border-bottom: 1px solid var(--line, #f0f2f0); }
.sup-sim:last-child { border-bottom: 0; }
.sup-sim-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }

/* Popover */
.sup-popover { position: absolute; z-index: 1000; width: 420px; max-width: calc(100vw - 16px); background: #fff; border: 1px solid var(--line, #d9ded9); border-radius: 14px; box-shadow: 0 18px 46px rgba(20,40,25,.18); padding: 14px; }
.sup-popover[hidden] { display: none; }
.sup-pop-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sup-pop-body { max-height: 300px; overflow-y: auto; }
.sup-pop-foot { border-top: 1px solid var(--line, #eef0ee); padding-top: 8px; margin-top: 8px; }
.sup-pop-tags { margin-top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.sup-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.sup-kv dt { font-size: 11px; color: var(--muted, #98a09a); text-transform: uppercase; letter-spacing: .03em; }
.sup-kv dd { margin: 0 0 4px; font-size: 13px; }
.sup-list { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-direction: column; gap: 6px; }
.sup-list li { font-size: 13px; }

/* Macro dialog */
.sup-dialog { border: 0; border-radius: 16px; padding: 18px; width: min(560px, 92vw); box-shadow: 0 24px 60px rgba(20,40,25,.25); }
.sup-dialog::backdrop { background: rgba(20,30,22,.4); }
.sup-macro label { display: block; margin-bottom: 12px; }
.sup-macro select { width: 100%; padding: 8px; border: 1px solid var(--line, #d9ded9); border-radius: 8px; font: inherit; margin-top: 4px; }
.sup-preview pre { background: #10231a; color: #d7ecdd; padding: 12px; border-radius: 10px; overflow-x: auto; font-size: 12px; line-height: 1.5; }
.sup-macro-actions { margin-top: 12px; display: flex; justify-content: flex-end; }

/* Self-service simulator */
.sup-sim-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.sup-phone { max-width: 420px; margin: 12px 0; border: 1px solid var(--line, #d9ded9); border-radius: 20px; overflow: hidden; box-shadow: 0 12px 34px rgba(20,40,25,.12); background: #fff; }
.sup-phone-head { background: var(--green, #2e7d54); color: #fff; padding: 12px 16px; font-weight: 600; font-size: 14px; }
.sup-phone-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 220px; background: #f6f8f6; }
.sup-phone-foot { padding: 10px 14px; border-top: 1px solid var(--line, #eef0ee); }
.sup-bot-msg { align-self: flex-start; background: #fff; border: 1px solid var(--line, #e4e7e4); padding: 8px 12px; border-radius: 12px; max-width: 85%; }
.sup-client-msg { align-self: flex-end; background: #dff2e6; padding: 8px 12px; border-radius: 12px; max-width: 85%; }
.sup-sys-msg { align-self: center; color: var(--muted, #78807a); font-size: 12px; font-style: italic; }
.sup-startmenu { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.sup-startbtn { text-align: left; border: 1px solid var(--green, #2e7d54); color: var(--green, #2e7d54); background: #fff; border-radius: 10px; padding: 8px 12px; cursor: pointer; font: inherit; }
.sup-startbtn:hover { background: #eef7f1; }
.sup-sim-input { display: flex; gap: 6px; margin-top: 4px; }
.sup-sim-input input { flex: 1; padding: 8px; border: 1px solid var(--line, #d9ded9); border-radius: 8px; font: inherit; }
.sup-sim-csat { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sup-sim-account { border-top: 1px dashed var(--line, #dde2dd); padding: 10px 14px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }

/* Self-service constructor */
.sup-json { width: 100%; min-height: 220px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; border: 1px solid var(--line, #d9ded9); border-radius: 10px; padding: 10px; margin: 6px 0; }
.sup-ss-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.sup-ss-chan label { margin-right: 8px; font-size: 13px; }
.sup-errs { color: #b02a1c; margin: 4px 0; padding-left: 18px; }
.sup-ok { color: #1f7a48; font-weight: 600; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

@media (max-width: 860px) {
  .sup-chatgrid { grid-template-columns: 1fr; }
  .sup-phone { max-width: 100%; }
}
