/* CRM da Curva: estilos do módulo E-mail (campanhas, assistente, relatório, modelos, editor em blocos, relatórios).
   Carregado por index.php depois de app.css; usa as variáveis de cor de lá (claro e escuro). */

/* ---------------------------------------------------------------- lista de campanhas */
.cp-filters .search { flex: 1 1 240px; max-width: 420px; }
.cp-table td.name a { color: var(--text); font-weight: 600; text-decoration: none; }
.cp-table td.name a:hover { color: var(--link); }
.cp-table td.name .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 1px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-table td.lists-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--text-2); }
.cp-table td.date-cell { white-space: nowrap; color: var(--text-2); font-size: 12.5px; }
.cp-table .rate { font-variant-numeric: tabular-nums; }
.cp-table .rate small { color: var(--muted); margin-left: 3px; }
.cp-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
@media (max-width: 760px) { .cp-table .hide-xs-col { display: none; } }

/* ---------------------------------------------------------------- assistente */
.cp-wizard { max-width: 980px; }
.cp-wizard [hidden] { display: none !important; }
.cp-wizard .wizard-steps .step { cursor: pointer; border: 0; font: inherit; }
.cp-wizard .wizard-steps .step:disabled { cursor: default; }
.cp-step-title { font-size: 17px; margin: 0 0 4px; }
.cp-step-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.cp-lists { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.cp-list-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--separator); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.cp-list-opt.on { border-color: var(--accent); background: var(--accent-tint); }
.cp-list-opt input { margin: 0; }
.cp-list-opt .n { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cp-count-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); margin-top: 14px; }
.cp-count-box b { font-size: 20px; font-variant-numeric: tabular-nums; }
.cp-form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@media (max-width: 700px) { .cp-form-2 { grid-template-columns: 1fr; } }
.cp-subject-row { display: flex; gap: 6px; align-items: center; }
.cp-subject-row .input { flex: 1; }
.cp-tracking { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 4px; }
.cp-tracking label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.cp-content-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 800px) { .cp-content-cards { grid-template-columns: 1fr; } }
.cp-content-card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 16px; border: 1px solid var(--separator); border-radius: var(--radius-l); background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.cp-content-card:hover { border-color: var(--accent); }
.cp-content-card .icon { color: var(--accent); }
.cp-content-card b { font-size: 14.5px; }
.cp-content-card small { color: var(--muted); line-height: 1.4; }
.cp-preview-wrap { background: var(--surface-2); border-radius: var(--radius-l); padding: 16px; display: flex; justify-content: center; }
.cp-preview { width: 100%; max-width: 680px; height: 560px; border: 0; border-radius: var(--radius); background: #F5F5F7; }
.cp-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cp-preview-head .subject { font-weight: 600; }
.cp-preview-head .pre { color: var(--muted); font-size: 13px; }
.cp-checklist { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cp-checklist li { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: var(--radius); background: var(--fill-2); font-size: 13.5px; line-height: 1.4; }
.cp-checklist li .icon { flex: none; margin-top: 1px; }
.cp-checklist li.ok .icon { color: var(--green); }
.cp-checklist li.err { background: var(--red-tint); color: var(--red); }
.cp-checklist li.warn { background: var(--warn-bg); color: var(--warn-text); }
.cp-summary { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 13.5px; margin-bottom: 16px; }
.cp-summary > b { color: var(--muted); font-weight: 600; }
.cp-when { display: flex; flex-direction: column; gap: 10px; }
.cp-when .radio-card { align-items: center; }
.cp-when .when-fields { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: 30px; }
.cp-send-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 18px; }

/* ---------------------------------------------------------------- relatório da campanha */
.cp-report-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cp-report-head .meta { color: var(--muted); font-size: 13px; }
.cp-progress { padding: 12px 14px; }
.cp-progress .bar { margin: 8px 0 6px; }
.cp-progress .row-gap { justify-content: space-between; }
.cp-chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding: 8px 0 0; overflow-x: auto; }
.cp-chart .col { flex: 1 0 18px; max-width: 48px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 0; position: relative; }
.cp-chart .col .bars { display: flex; align-items: flex-end; gap: 2px; height: calc(100% - 18px); width: 100%; justify-content: center; }
.cp-chart .col .b { width: 45%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--accent); transition: height .25s; }
.cp-chart .col .b.clicks { background: var(--link); }
.cp-chart .col .lbl { font-size: 10.5px; color: var(--muted); height: 18px; line-height: 18px; white-space: nowrap; }
.cp-chart .col:hover .b { filter: brightness(1.08); }
.cp-chart-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.cp-chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); vertical-align: -1px; margin-right: 5px; }
.cp-chart-legend i.clicks { background: var(--link); }
.cp-links td.url { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-links td.url a { color: var(--link); text-decoration: none; }
.cp-links .bar { width: 120px; }
.cp-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 10px 14px 0; border-bottom: 1px solid var(--separator); }
.cp-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 8px 10px; font: inherit; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.cp-tabs button.on { color: var(--text); font-weight: 650; border-bottom-color: var(--accent); }
.cp-tabs button .n { font-size: 11.5px; background: var(--fill); padding: 1px 6px; border-radius: 999px; color: var(--text-2); }
.cp-events { list-style: none; margin: 0; padding: 0; }
.cp-events li { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--separator); font-size: 13px; }
.cp-events li:last-child { border-bottom: 0; }
.cp-events .t { color: var(--muted); font-size: 12px; white-space: nowrap; margin-left: auto; }
.cp-events .status-badge { font-size: 11px; }

/* ---------------------------------------------------------------- modelos de e-mail */
.em-tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.em-tpl-grid .radio-card { flex-direction: column; gap: 2px; }
.em-tpl-grid .radio-card small { color: var(--muted); }

/* ---------------------------------------------------------------- editor em blocos */
.ed { display: grid; grid-template-rows: auto 1fr; height: calc(100vh - var(--topbar) - 2px); margin: -16px -20px; overflow: hidden; background: var(--bg); }
@media (max-width: 1100px) { .ed { margin: -12px -14px; height: calc(100vh - var(--topbar)); } }
.ed-top { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--separator); flex-wrap: wrap; }
.ed-top .input { height: 32px; font-size: 13.5px; }
.ed-top .ed-name { width: 220px; font-weight: 600; }
.ed-top .ed-subject { flex: 1 1 260px; min-width: 180px; }
.ed-top .ed-pre { flex: 1 1 200px; min-width: 140px; }
.ed-top .ed-from { min-width: 150px; }
.ed-top .ed-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ed-top .ed-status.dirty { color: var(--accent-text); }
.ed-body { display: grid; grid-template-columns: 220px 1fr 300px; min-height: 0; }
.ed-side { background: var(--surface); border-right: 1px solid var(--separator); overflow-y: auto; padding: 12px; }
.ed-side h3 { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 10px; }
.ed-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ed-block-src { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 6px 10px; border: 1px solid var(--separator); border-radius: var(--radius); background: var(--surface); cursor: grab; font-size: 12px; color: var(--text-2); user-select: none; text-align: center; }
.ed-block-src:hover { border-color: var(--accent); color: var(--text); }
.ed-block-src:active { cursor: grabbing; }
.ed-block-src .icon { color: var(--accent); }
.ed-side-hint { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.45; }
.ed-canvas { overflow: auto; padding: 24px 16px; display: flex; justify-content: center; align-items: flex-start; }
.ed-canvas.mobile .ed-mail { width: 375px !important; }
.ed-mail { width: 600px; max-width: 100%; border-radius: 12px; overflow: visible; position: relative; }
.ed-mail .ed-content { position: relative; }
.ed-empty { padding: 48px 24px; text-align: center; color: #86868B; font-size: 14px; border: 2px dashed rgba(120, 120, 128, .35); border-radius: 10px; margin: 12px; }
.ed-blk { position: relative; cursor: pointer; }
.ed-blk::after { content: ""; position: absolute; inset: 0; pointer-events: none; border: 1px solid transparent; border-radius: 4px; transition: border-color .12s; }
.ed-blk:hover::after { border-color: rgba(0, 109, 246, .5); }
.ed-blk.sel::after { border: 2px solid var(--accent); }
.ed-blk.drag::after { opacity: .5; }
.ed-blk-tools { position: absolute; top: -14px; right: 6px; z-index: 3; display: none; gap: 2px; background: var(--accent); border-radius: 7px; padding: 2px; box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
.ed-blk.sel > .ed-blk-tools { display: inline-flex; }
.ed-blk-tools button { border: 0; background: none; color: #fff; width: 24px; height: 22px; display: grid; place-items: center; border-radius: 5px; cursor: pointer; padding: 0; }
.ed-blk-tools button:hover { background: rgba(255, 255, 255, .22); }
.ed-blk-tools button.grab { cursor: grab; }
.ed-blk-label { position: absolute; top: -14px; left: 6px; z-index: 3; display: none; font-size: 10.5px; font-weight: 600; color: #fff; background: var(--accent); padding: 2px 7px; border-radius: 6px; pointer-events: none; }
.ed-blk.sel > .ed-blk-label { display: block; }
.ed-drop { height: 0; transition: height .12s, margin .12s; pointer-events: none; }
.ed-dragging .ed-drop { pointer-events: auto; height: 10px; margin: 0; }
.ed-dragging .ed-drop.over { height: 42px; background: rgba(0, 109, 246, .12); border: 2px dashed var(--link); border-radius: 8px; margin: 4px 8px; }
.ed-col-drop { min-height: 40px; }
.ed-col-empty { padding: 14px 8px; text-align: center; color: #A1A1A6; font-size: 12px; border: 1px dashed rgba(120, 120, 128, .4); border-radius: 8px; margin: 4px; }
.ed-text[contenteditable] { outline: none; min-height: 1.4em; }
.ed-text[contenteditable]:focus { box-shadow: none; }
.ed-text p { margin: 0 0 12px; }
.ed-text ul, .ed-text ol { margin: 0 0 12px; padding-left: 24px; }
.ed-text p:last-child, .ed-text ul:last-child, .ed-text ol:last-child { margin-bottom: 0; }
.ed-text a { text-decoration: underline; }
.ed-img-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 12px; background: #EFEFF2; color: #86868B; border-radius: 8px; font-size: 13px; }
.ed-footer { padding: 20px 24px 8px; text-align: center; font-size: 12px; line-height: 1.6; color: #86868B; }
.ed-footer a { color: #86868B; }
.ed-props { background: var(--surface); border-left: 1px solid var(--separator); overflow-y: auto; padding: 14px; }
.ed-props h3 { font-size: 14px; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ed-props h3 small { font-size: 12px; color: var(--muted); font-weight: 500; }
.ed-props .form { gap: 11px; }
.ed-props .field > span { font-size: 12.5px; }
.ed-props .input { height: 32px; font-size: 13.5px; }
.ed-props textarea.input { height: auto; min-height: 90px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.ed-props .grid2 { gap: 8px; }
.ed-props .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ed-props .grid4 .input { padding: 0 6px; text-align: center; }
.ed-props .grid4 .field > span { text-align: center; }
.ed-color { display: flex; align-items: center; gap: 6px; }
.ed-color input[type=color] { width: 32px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: 7px; background: none; cursor: pointer; }
.ed-color .input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.ed-toolbar { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px; border: 1px solid var(--separator); border-radius: var(--radius); background: var(--surface-2); }
.ed-toolbar button { width: 30px; height: 28px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--text-2); display: grid; place-items: center; font: inherit; font-size: 13px; }
.ed-toolbar button:hover { background: var(--hover); color: var(--text); }
.ed-toolbar button.on { background: var(--surface); color: var(--accent-text); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.ed-toolbar .sep { width: 1px; height: 20px; background: var(--separator); margin: 4px 2px; }
.ed-align { display: inline-flex; padding: 2px; gap: 2px; border-radius: 8px; background: var(--fill); }
.ed-align button { min-width: 34px; padding: 0 9px; font: inherit; font-size: 12px; height: 28px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--text-2); display: grid; place-items: center; }
.ed-align button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.ed-upload { display: flex; gap: 6px; align-items: center; }
.ed-upload .btn { height: 32px; }
.ed-social-item { display: grid; grid-template-columns: 110px 1fr auto; gap: 6px; align-items: center; }
.ed-props .btn.danger-text { color: var(--red); }
.ed-props .ed-section { border-top: 1px solid var(--separator); padding-top: 10px; margin-top: 2px; }
.ed-props .ed-section > b { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.ed-html-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 0; min-height: 0; }
.ed-html-mode textarea { width: 100%; height: 100%; border: 0; border-right: 1px solid var(--separator); resize: none; padding: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface); color: var(--text); outline: none; }
.ed-html-mode iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.ed-preview-frame { width: 100%; height: 100%; border: 0; background: #F5F5F7; }
.ed-preview-wrap { display: flex; justify-content: center; padding: 20px; overflow: auto; }
.ed-preview-wrap iframe { width: 680px; max-width: 100%; height: calc(100vh - var(--topbar) - 110px); border: 0; border-radius: 12px; background: #F5F5F7; box-shadow: var(--shadow); }
.ed-preview-wrap.mobile iframe { width: 390px; }
.ed-mobile-notice { padding: 24px; }
@media (max-width: 1000px) {
  .ed-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .ed-side, .ed-props { max-height: 34vh; border: 0; border-bottom: 1px solid var(--separator); }
  .ed-blocks { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}

/* ---------------------------------------------------------------- relatórios gerais */
.rp-tabs { margin-bottom: 16px; }
.rp-chart { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding-top: 6px; }
.rp-chart .col { flex: 1 1 0; min-width: 3px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; position: relative; }
.rp-chart .col .b { min-height: 2px; border-radius: 3px 3px 0 0; background: var(--accent); }
.rp-chart .col .b.un { background: var(--muted); opacity: .6; border-radius: 0 0 3px 3px; }
.rp-chart .col:hover .b { filter: brightness(1.1); }
.rp-chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.rp-bars { display: flex; flex-direction: column; gap: 8px; }
.rp-bars .rb { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 70px; gap: 10px; align-items: center; font-size: 13.5px; }
.rp-bars .rb .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-bars .rb .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.rp-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.rp-head-row h2 { margin: 0; }
.rp-table td.name a { color: var(--text); font-weight: 600; text-decoration: none; }
.rp-table td.name a:hover { color: var(--link); }
.rp-tooltip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff; font-size: 11.5px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; display: none; z-index: 2; }
.rp-chart .col:hover .rp-tooltip, .cp-chart .col:hover .rp-tooltip { display: block; }
