/* dashboard.css — Dashboard de Resultados (public/dashboard.js). Usa os tokens do CRM
   (sirius-ui.css) e acrescenta só as cores semânticas do dashboard, em claro e escuro. */
:root {
  --dsh-won: #34D399; --dsh-lost: #FF3366; --dsh-open: #B66FFF;
  --dsh-traf: #00F6F5; --dsh-disp: #D24EFF; --dsh-form: #5B8DEF; --dsh-org: #FFB84D;
  --dsh-neutral: rgba(255,255,255,.26); --dsh-grid: rgba(255,255,255,.06);
  --dsh-on-bar: #041018;
}
[data-theme="light"] {
  --dsh-won: #0E9F6E; --dsh-lost: #D61F4F; --dsh-open: #6B57E0;
  --dsh-traf: #00838F; --dsh-disp: #A21CAF; --dsh-form: #2F6BD8; --dsh-org: #B7791F;
  --dsh-neutral: rgba(14,27,42,.25); --dsh-grid: rgba(14,27,42,.07);
}

.dsh { display: flex; flex-direction: column; gap: 16px; max-width: 1480px; font-variant-numeric: tabular-nums; }
.dsh-head { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; justify-content: space-between; }
.dsh-head-t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dsh-eyebrow { font: 600 11px/1.2 var(--ff-display); letter-spacing: .18em; text-transform: uppercase; color: var(--accent-text, var(--cyan)); }
.dsh-updated { font-size: 12px; color: var(--muted); }
.dsh-filters, .dsh-subfilters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#dashboard-body .dsh .dash-sel { min-width: 150px; height: 38px; padding-top: 0; padding-bottom: 0; }
#dashboard-body .dsh .dsh-days { min-width: 0; width: 112px; padding-right: 12px; background-image: none; }
.dsh-lbl { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }

/* KPIs */
.dsh-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.dsh-grid > .dsh-strip { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.dsh > .dsh-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1180px) { .dsh > .dsh-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dsh-kpi {
  position: relative; min-width: 0; display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px 12px; border-radius: 14px;
  background: linear-gradient(180deg, var(--sd-raise), var(--surface));
  border: 1px solid var(--sd-border-2);
}
.dsh-kpi::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--k, transparent); }
.dsh-kpi.sk { min-height: 108px; opacity: .5; }
.dsh-kpi-l { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dsh-kpi-v { font: 700 27px/1.15 var(--ff-display); letter-spacing: -.02em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsh-kpi-v small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.dsh-kpi.small .dsh-kpi-v { font-size: 19px; }
.dsh-kpi-f { font-size: 12px; color: var(--muted); min-height: 1.4em; }
.dsh-spark { width: 100%; height: 26px; display: block; margin-top: 2px; }
.dsh-d { font: 600 10.5px/1 var(--ff-body); letter-spacing: 0; text-transform: none; padding: 3px 7px; border-radius: 999px; white-space: nowrap; }
.dsh-d.up { color: var(--dsh-won); background: color-mix(in srgb, var(--dsh-won) 14%, transparent); }
.dsh-d.dn { color: var(--dsh-lost); background: color-mix(in srgb, var(--dsh-lost) 14%, transparent); }
.dsh-d.flat { color: var(--muted); background: var(--sd-raise-2, var(--sd-raise)); }

/* Leitura do período */
.dsh-insight { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: start; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent); }
.dsh-insight-ic { grid-row: span 2; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font: 700 14px var(--ff-display); color: var(--accent-text, var(--cyan)); background: color-mix(in srgb, var(--cyan) 11%, transparent); }
.dsh-insight h3 { margin: 0; font: 600 12px var(--ff-display); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text, var(--cyan)); }
.dsh-insight ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; color: var(--text); }
.dsh-insight b { font-weight: 600; }

/* Abas */
.dsh-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--sd-border-2); overflow-x: auto; scrollbar-width: none; }
.dsh-tabs::-webkit-scrollbar { display: none; }
.dsh-tab { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 11px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: 600 14px var(--ff-display); cursor: pointer; }
.dsh-tab:hover { color: var(--text); }
.dsh-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--cyan); }
.dsh-tab:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; border-radius: 6px; }
.dsh-pill { font: 600 9.5px var(--ff-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--sd-border-2); padding: 1px 6px; border-radius: 999px; }
.dsh-loading, .dsh-empty { color: var(--muted); font-size: 13.5px; padding: 18px 2px; }

/* Grade e cartões */
.dsh-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.dsh-grid > .c12 { grid-column: span 12; }
.dsh-grid > .c7 { grid-column: span 7; }
.dsh-grid > .c6 { grid-column: span 6; }
.dsh-grid > .c5 { grid-column: span 5; }
@media (max-width: 1000px) { .dsh-grid > .c7, .dsh-grid > .c6, .dsh-grid > .c5 { grid-column: span 12; } }
.dsh-card { min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; border-radius: 14px; background: linear-gradient(180deg, var(--sd-raise), var(--surface)); border: 1px solid var(--sd-border-2); }
.dsh-card h3 { margin: 0; font: 600 15px var(--ff-display); color: var(--text); letter-spacing: -.01em; }
.dsh-hint { margin: -6px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); max-width: 90ch; }
.dsh-p { margin: 0; color: var(--muted); font-size: 13.5px; }

.dsh-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.dsh-seg button { font: 500 12px var(--ff-body); color: var(--muted); background: var(--sd-raise); border: 1px solid var(--sd-border-2); border-radius: 999px; padding: 5px 11px; cursor: pointer; }
.dsh-seg button:hover { color: var(--text); }
.dsh-seg button[aria-pressed="true"] { color: var(--accent-text, var(--cyan)); border-color: color-mix(in srgb, var(--cyan) 45%, transparent); background: color-mix(in srgb, var(--cyan) 10%, transparent); }

/* Funil */
.dsh-fun { display: flex; flex-direction: column; gap: 7px; }
.dsh-fr { display: grid; grid-template-columns: minmax(90px, 170px) 1fr 76px; gap: 10px; align-items: center; border-radius: 8px; }
.dsh-fr.click { cursor: pointer; }
.dsh-fr.click:hover .dsh-fr-nm { color: var(--text); }
.dsh-fr.click:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.dsh-fr-nm { font-size: 13px; color: var(--text-secondary, var(--muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsh-fr-tr { height: 26px; background: var(--dsh-grid); border-radius: 7px; overflow: hidden; }
.dsh-fr-bar { height: 100%; min-width: 34px; border-radius: 7px; display: flex; align-items: center; padding-left: 9px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 50%, transparent), var(--c)); }
.dsh-fr-bar span { font: 700 12px var(--ff-display); color: var(--dsh-on-bar); }
.dsh-fr-cv { font-size: 12px; color: var(--muted); text-align: right; }
.dsh-fr-cv.bad { color: var(--dsh-lost); font-weight: 700; }
.dsh-fnote { display: block; padding-top: 10px; border-top: 1px dashed var(--sd-border-2); font-size: 12.5px; color: var(--muted); }
.dsh-fnote b { color: var(--dsh-lost); font-weight: 600; }
.dsh-fnote-h { display: block; margin-bottom: 6px; font-weight: 600; color: var(--text); }
.dsh-recent-list { display: flex; flex-direction: column; gap: 6px; }
.dsh-recent { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.dsh-recent > span:first-child { color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.dsh-recent .v { color: var(--muted); white-space: nowrap; }

/* Barras empilhadas e legenda */
.dsh-stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--dsh-grid); }
.dsh-stack span { display: block; height: 100%; min-width: 3px; }
.dsh-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
.dsh-lg { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: baseline; font-size: 13px; color: var(--text); }
.dsh-lg i { width: 10px; height: 10px; border-radius: 3px; align-self: center; }
.dsh-lg .v { font-size: 12px; color: var(--muted); white-space: nowrap; }
.dsh-lg .v b { color: var(--text); font-weight: 600; font-size: 13px; }

/* Barras horizontais (motivos) */
.dsh-hb { display: flex; flex-direction: column; gap: 9px; }
.dsh-hr { display: grid; grid-template-columns: minmax(110px, 220px) 1fr 84px; gap: 10px; align-items: center; font-size: 13px; }
.dsh-hr .nm { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-hr .nm.muted { color: var(--muted); }
.dsh-hr .t { height: 10px; background: var(--dsh-grid); border-radius: 5px; overflow: hidden; }
.dsh-hr .t span { display: block; height: 100%; border-radius: 5px; background: var(--c); }
.dsh-hr .v { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.dsh-hr .v b { color: var(--text); font-weight: 600; font-size: 13px; }

/* Semanal */
.dsh-weekly { width: 100%; height: auto; display: block; }
.dsh-weekly text { fill: var(--muted); font: 10px var(--ff-body); }
.dsh-weekly .gl { stroke: var(--dsh-grid); }
.dsh-weekly .bw { fill: var(--dsh-won); }
.dsh-weekly .bl { fill: var(--dsh-lost); }

/* Tabelas */
.dsh-tw { overflow-x: auto; margin: 0 -4px; }
.dsh-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.dsh .dsh-t th { background: transparent; color: var(--muted) !important; position: static; font: 600 10.5px var(--ff-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: right; padding: 8px; border-bottom: 1px solid var(--sd-border-2); white-space: nowrap; }
.dsh-t td { padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--sd-hair, var(--sd-border-2)); white-space: nowrap; color: var(--text); }
.dsh-t th:first-child, .dsh-t td:first-child { text-align: left; }
.dsh-t td.wrap { white-space: normal; min-width: 160px; max-width: 320px; }
.dsh-t tbody tr:last-child td { border-bottom: 0; }
.dsh-t tfoot td { font-weight: 700; border-top: 1px solid var(--sd-border-2); border-bottom: 0; }
.dsh-t tr.click { cursor: pointer; }
.dsh-t tr.click:hover td { background: var(--sd-raise); }
.dsh-t tr.click:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.dsh-t tr.sel td { background: color-mix(in srgb, var(--cyan) 9%, transparent); }
.dsh-t tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--cyan); }
.dsh-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.dsh-muted { color: var(--muted); }
.dsh-roas { font: 700 11.5px var(--ff-display); padding: 2px 8px; border-radius: 999px; }
.dsh-roas.g { color: var(--dsh-won); background: color-mix(in srgb, var(--dsh-won) 14%, transparent); }
.dsh-roas.m { color: var(--amber); background: color-mix(in srgb, var(--amber) 16%, transparent); }
.dsh-roas.b { color: var(--dsh-lost); background: color-mix(in srgb, var(--dsh-lost) 14%, transparent); }
.dsh-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; line-height: 1.5; color: var(--muted); }
.dsh-tag { flex: none; margin-top: 1px; font: 600 9.5px var(--ff-body); letter-spacing: .06em; text-transform: uppercase; color: var(--lilas); border: 1px solid color-mix(in srgb, var(--lilas) 45%, transparent); padding: 2px 7px; border-radius: 999px; }

/* Do anúncio à venda */
.dsh-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.dsh-step { min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--sd-raise); border: 1px solid var(--sd-border-2); }
.dsh-step .k { font-size: 12px; color: var(--muted); }
.dsh-step .n { font: 700 22px var(--ff-display); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsh-step .r { font-size: 12px; color: var(--accent-text, var(--cyan)); }
.dsh-step.money .n { color: var(--accent-text, var(--cyan)); }
.dsh-step.win .n { color: var(--dsh-won); }
@media (max-width: 760px) { .dsh-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dsh-callout { font-size: 13px; line-height: 1.5; color: var(--text); padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--amber) 10%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 32%, transparent); }
.dsh-callout b { color: var(--amber); }

/* Conta do WhatsApp */
.dsh-bill-num { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.dsh-bill-num + .dsh-bill-num { border-top: 1px dashed var(--sd-border-2); padding-top: 14px; }
.dsh-bill-h { font-size: 13px; color: var(--muted); }
.dsh-bill-h b { color: var(--text); }
.dsh-save { font-size: 13.5px; line-height: 1.5; color: var(--text); padding: 11px 14px; border-radius: 10px; background: color-mix(in srgb, var(--dsh-won) 10%, transparent); border: 1px solid color-mix(in srgb, var(--dsh-won) 32%, transparent); }
.dsh-save b { color: var(--dsh-won); }
.dsh-fqlbl { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.dsh-fqlbl b { color: var(--text); }
.dsh-fq { display: flex; height: 18px; gap: 2px; border-radius: 9px; overflow: hidden; background: var(--dsh-grid); }
.dsh-fq span { display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; font: 600 10.5px var(--ff-body); color: var(--dsh-on-bar); }
.dsh-fq .free { background: var(--cyan); }
.dsh-fq .paid { background: var(--amber); }
.dsh-fq .rest { background: transparent; }
.dsh-bill td.free { color: var(--dsh-won); font-weight: 600; }
.dsh .dsh-bill th:nth-child(2), .dsh-bill td:nth-child(2) { text-align: left; }

@media (max-width: 640px) {
  #dashboard-body .dsh .dash-sel { min-width: 0; flex: 1 1 140px; }
  .dsh-lbl { flex: 1 1 100%; justify-content: space-between; }
  .dsh-lbl .dash-sel { flex: 1 1 auto; }
  .dsh-strip, .dsh > .dsh-strip, .dsh-grid > .dsh-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dsh-kpi-v { font-size: 22px; }
  .dsh-kpi.small .dsh-kpi-v { font-size: 18px; }
  .dsh-card { padding: 14px; }
  .dsh-fr { grid-template-columns: minmax(70px, 110px) 1fr 58px; gap: 8px; }
  .dsh-hr { grid-template-columns: minmax(80px, 130px) 1fr 72px; }
  .dsh-legend { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .dsh-fr-bar, .dsh-hr .t span { transition: width .4s ease; }
}
