/* DistribuiPro Dashboard Pro 1.0 */
.dpd .stat-card { position: relative; overflow: hidden; }
.dpd .stat-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--accent), transparent 70%); opacity: .55; }
.dpd .stat-change.dpd-flat { background: rgba(148, 163, 184, .12) !important; color: var(--text-muted) !important; }
.dpd .stat-change.down { background: rgba(239, 68, 68, .12) !important; color: #f87171 !important; }
.dpd .stat-change[hidden] { display: none !important; }
.dpd-spark { position: absolute; right: 12px; bottom: 12px; width: 44%; max-width: 150px; height: 34px; color: var(--accent); opacity: .9; pointer-events: none; }
.dpd-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--accent) !important; text-decoration: none; opacity: .85; transition: gap .2s, opacity .2s; }
.dpd-link:hover { opacity: 1; gap: 9px; }
.dpd-link i { font-size: 10px; }

/* Botão de atualização */
.dpd-stamp { display: inline-flex; align-items: center; gap: 7px; margin-left: 12px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-color); background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 600; cursor: pointer; transition: color .2s, border-color .2s; }
.dpd-stamp:hover { color: var(--text-primary); border-color: var(--accent); }
.dpd-stamp .fa-rotate-right { font-size: 11px; }
.dpd-stamp.spin .fa-rotate-right { animation: dpdSpin .8s linear infinite; }
.dpd-live { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: dpdPulse 2s infinite; }
@keyframes dpdPulse { 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
@keyframes dpdSpin { to { transform: rotate(360deg); } }

/* Linha: meta + destaques */
.dpd-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 16px; margin: 0 0 24px; }
.dpd-goal-body { display: flex; align-items: center; gap: 22px; }
.dpd-ring { position: relative; flex: 0 0 auto; width: 132px; height: 132px; }
.dpd-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dpd-ring circle { fill: none; stroke-width: 11; }
.dpd-ring .bg { stroke: rgba(148, 163, 184, .14); }
.dpd-ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2, .8, .2, 1); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 55%, transparent)); }
.dpd-ring > div { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.dpd-ring strong { font-size: 26px; font-weight: 800; letter-spacing: -.03em; color: var(--text-heading, var(--text-primary)); line-height: 1; }
.dpd-ring small { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.dpd-goal-data { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; min-width: 0; }
.dpd-goal-data dt { font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--text-muted); }
.dpd-goal-data dd { margin: 3px 0 0; font-size: 15px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dpd-goal-data dd.pos { color: var(--success); }
.dpd-goal-data dd.neg { color: var(--warning); }
.dpd-goal-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-color); }
.dpd-goal-form[hidden] { display: none; }
.dpd-goal-form label { flex: 1 1 200px; display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.dpd-goal-form input { height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--bg-input); color: var(--text-primary); font-size: 15px; }
.dpd-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); white-space: nowrap; }
.dpd-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dpd-tile { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; border: 1px solid var(--border-color); background: var(--bg-surface, transparent); min-width: 0; transition: transform .2s, border-color .2s; }
.dpd-tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border-color)); }
.dpd-tile > div { min-width: 0; display: grid; gap: 2px; }
.dpd-tile small { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.dpd-tile strong { font-size: 15px; font-weight: 800; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dpd-tile em { font-style: normal; font-size: 12px; color: var(--text-muted); }
.dpd-ti { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 15px; }
.dpd-ti.green { color: #34d399; background: rgba(16, 185, 129, .14); }
.dpd-ti.blue { color: #60a5fa; background: rgba(59, 130, 246, .14); }
.dpd-ti.yellow { color: #fbbf24; background: rgba(245, 158, 11, .14); }
.dpd-ti.purple { color: #c084fc; background: rgba(168, 85, 247, .14); }
.dpd-empty-box { display: grid; place-items: center; gap: 10px; padding: 26px 12px; text-align: center; color: var(--text-muted); font-size: 13px; }
.dpd-empty-box i { font-size: 26px; opacity: .45; }
.dpd-empty-box p { margin: 0; max-width: 340px; }

/* Gráficos */
.dpd .chart-container { position: relative; }
.dpd-chart-empty { position: absolute; inset: 30px 0 24px 50px; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; pointer-events: none; color: var(--text-muted); font-size: 12.5px; }
.dpd-chart-empty i { font-size: 22px; opacity: .5; }
.dpd-chart-empty b { font-size: 14px; color: var(--text-primary); }
.dpd-legend { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.dpd-legend li { display: grid; grid-template-columns: 10px 1fr auto 42px; align-items: center; gap: 10px; font-size: 13px; color: var(--text-primary); }
.dpd-legend li i { width: 10px; height: 10px; border-radius: 3px; }
.dpd-legend li b { font-weight: 700; font-variant-numeric: tabular-nums; }
.dpd-legend li em { font-style: normal; text-align: right; color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dpd-legend .dpd-legend-empty { display: block; text-align: center; color: var(--text-muted); font-size: 12.5px; }

/* Textos pequenos demais nas tabelas do painel */
.dpd #recentSalesBody [style*="font-size:10px"], .dpd #topProductsBody [style*="font-size:10px"] { font-size: 11.5px !important; }
.dpd #recentSalesBody .badge { font-size: 11px !important; }

@media (max-width: 1100px) { .dpd-row { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .dpd-goal-body { flex-direction: column; align-items: stretch; gap: 16px; }
  .dpd-ring { align-self: center; width: 120px; height: 120px; }
  .dpd-tiles { grid-template-columns: 1fr; }
  .dpd-spark { width: 40%; height: 28px; bottom: 10px; }
  .dpd-stamp { margin: 8px 0 0; }
  .dpd-legend li { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) { .dpd-live, .dpd-stamp.spin .fa-rotate-right { animation: none; } .dpd-ring .fg { transition: none; } }

/* 37.3 · O número do card se ajusta à largura (não fica cortado com 7 cards na linha) e o minigráfico fica embaixo, sem cobrir o valor */
.dpd .stat-card { container-type: inline-size; }
.dpd .stat-card .stat-value { font-size: clamp(16px, 13.5cqi, 28px) !important; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.02em !important; }
.dpd .stat-card .dpd-spark { position: static; display: block; grid-area: 4 / 1 / 5 / -1 !important; justify-self: stretch !important; width: 100% !important; max-width: none !important; height: 26px; margin-top: 2px; opacity: .85; }
@supports not (font-size: 1cqi) { .dpd .stat-card .stat-value { font-size: 20px !important; } }
/* 39.16 · Cards no novo visual: ícone colorido + nome em cima, selo/ajuda no canto, valor grande,
   variação em pílula verde/vermelha e minigráfico com pontos. 5 cards na 1ª linha e os de atalho (mais largos) embaixo. */
body.dpd { --dpc-bg: var(--bg-card); --dpc-line: var(--st-line, var(--border-color)); --dpc-title: var(--text-heading, var(--text-primary)); --dpc-text: var(--text-primary); --dpc-muted: var(--text-muted); --dpc-link: #6d9bff; --dpc-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 30px -18px rgba(0, 0, 0, .6); --dpc-blue: #1f5eff; }
html[data-theme="light"] body.dpd { --dpc-bg: #fff; --dpc-line: #e7ecf4; --dpc-title: #0d1b3e; --dpc-text: #1e2a45; --dpc-muted: #7a869c; --dpc-link: #1f5eff; --dpc-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 30px -18px rgba(16, 24, 40, .16); }
.dpc-rev { --dpc-c: #1f5eff; --dpc-t: rgba(31, 94, 255, .1); --dpc-s: #1f5eff; }
.dpc-profit { --dpc-c: #16a34a; --dpc-t: rgba(34, 197, 94, .12); --dpc-s: #22a55a; }
.dpc-orders { --dpc-c: #16a34a; --dpc-t: rgba(34, 197, 94, .12); --dpc-s: #6d4aff; }
.dpc-ticket { --dpc-c: #7c4dff; --dpc-t: rgba(124, 77, 255, .12); --dpc-s: #f59e0b; }
.dpc-pending { --dpc-c: #f97316; --dpc-t: rgba(249, 115, 22, .12); }
.dpc-delivered { --dpc-c: #16a34a; --dpc-t: rgba(34, 197, 94, .12); }
.dpc-low { --dpc-c: #ef4444; --dpc-t: rgba(239, 68, 68, .11); }
html:not([data-theme="light"]) .dpc-rev { --dpc-c: #6d9bff; --dpc-t: rgba(77, 132, 255, .16); --dpc-s: #6d9bff; }
html:not([data-theme="light"]) .dpc-profit, html:not([data-theme="light"]) .dpc-orders, html:not([data-theme="light"]) .dpc-delivered { --dpc-c: #34d399; --dpc-t: rgba(52, 211, 153, .14); }
html:not([data-theme="light"]) .dpc-profit { --dpc-s: #34d399; }
html:not([data-theme="light"]) .dpc-orders { --dpc-s: #9b87ff; }
html:not([data-theme="light"]) .dpc-ticket { --dpc-c: #a98bff; --dpc-t: rgba(169, 139, 255, .16); --dpc-s: #fbbf24; }
html:not([data-theme="light"]) .dpc-pending { --dpc-c: #fb923c; --dpc-t: rgba(251, 146, 60, .15); }
html:not([data-theme="light"]) .dpc-low { --dpc-c: #f87171; --dpc-t: rgba(248, 113, 113, .15); }

body.dpd #statsGrid { display: grid !important; grid-template-columns: repeat(15, minmax(0, 1fr)) !important; gap: 16px !important; align-items: stretch !important;
  /* ondas e pontinhos bem leves no espaço livre à direita dos cards de baixo */
  background: var(--dpc-waves) right -8px bottom -6px / min(56%, 640px) auto no-repeat; }
body.dpd { --dpc-waves: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 220' fill='none'%3E%3Cdefs%3E%3Cpattern id='d' width='11' height='11' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='1.5' cy='1.5' r='1.1' fill='%23ffffff'/%3E%3C/pattern%3E%3CradialGradient id='g' cx='.6' cy='.45' r='.5'%3E%3Cstop offset='0' stop-color='%23fff'/%3E%3Cstop offset='1' stop-color='%23fff' stop-opacity='0'/%3E%3C/radialGradient%3E%3Cmask id='m'%3E%3Crect width='640' height='220' fill='url(%23g)'/%3E%3C/mask%3E%3C/defs%3E%3Crect width='640' height='220' fill='url(%23d)' mask='url(%23m)' opacity='.1'/%3E%3Cg stroke='%23ffffff' stroke-width='1.1' opacity='.07'%3E%3Cpath d='M0 180C140 174 234 46 368 54S548 140 640 88'/%3E%3Cpath d='M0 188C145 180 242 58 374 66S554 150 640 100'/%3E%3Cpath d='M0 196C150 186 250 70 380 78S560 160 640 112'/%3E%3Cpath d='M0 204C155 192 258 82 386 90S566 170 640 124'/%3E%3Cpath d='M0 212C160 198 266 94 392 102S572 180 640 136'/%3E%3Cpath d='M0 220C165 204 274 106 398 114S578 190 640 148'/%3E%3C/g%3E%3C/svg%3E"); }
html[data-theme="light"] body.dpd { --dpc-waves: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 220' fill='none'%3E%3Cdefs%3E%3Cpattern id='d' width='11' height='11' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='1.5' cy='1.5' r='1.1' fill='%238fa6d6'/%3E%3C/pattern%3E%3CradialGradient id='g' cx='.6' cy='.45' r='.5'%3E%3Cstop offset='0' stop-color='%23fff'/%3E%3Cstop offset='1' stop-color='%23fff' stop-opacity='0'/%3E%3C/radialGradient%3E%3Cmask id='m'%3E%3Crect width='640' height='220' fill='url(%23g)'/%3E%3C/mask%3E%3C/defs%3E%3Crect width='640' height='220' fill='url(%23d)' mask='url(%23m)' opacity='.35'/%3E%3Cg stroke='%23a9bde3' stroke-width='1.1' opacity='.4'%3E%3Cpath d='M0 180C140 174 234 46 368 54S548 140 640 88'/%3E%3Cpath d='M0 188C145 180 242 58 374 66S554 150 640 100'/%3E%3Cpath d='M0 196C150 186 250 70 380 78S560 160 640 112'/%3E%3Cpath d='M0 204C155 192 258 82 386 90S566 170 640 124'/%3E%3Cpath d='M0 212C160 198 266 94 392 102S572 180 640 136'/%3E%3Cpath d='M0 220C165 204 274 106 398 114S578 190 640 148'/%3E%3C/g%3E%3C/svg%3E"); }
body.dpd #statsGrid > .stat-card { grid-column: span 3 !important; }
body.dpd #statsGrid > .stat-card:nth-child(n+6) { grid-column: span 4 !important; }
body.dpd #statsGrid > .stat-card.dpc { display: grid !important; grid-template-columns: auto minmax(0, 1fr) auto !important; grid-template-rows: auto auto auto 1fr !important;
  grid-template-areas: "icon label aux" "value value value" "chip chip chip" "foot foot foot" !important; align-items: center !important; column-gap: 12px !important; row-gap: 0 !important;
  padding: 18px 18px 14px !important; border-radius: 18px !important; background: var(--dpc-bg) !important; border: 1px solid var(--dpc-line) !important; box-shadow: var(--dpc-shadow) !important; text-align: left !important; }
body.dpd #statsGrid > .stat-card.dpc:hover { border-color: color-mix(in srgb, var(--dpc-c, var(--dpc-blue)) 30%, var(--dpc-line)) !important; }
body.dpd #statsGrid > .stat-card.dpc::before { display: none !important; }
body.dpd #statsGrid .dpc .stat-icon { grid-area: icon !important; width: 44px !important; height: 44px !important; border-radius: 12px !important; margin: 0 !important; justify-self: start !important; font-size: 21px !important; color: var(--dpc-c) !important; background: var(--dpc-t) !important; box-shadow: none !important; border: 0 !important; }
body.dpd #statsGrid .dpc .stat-icon .st-ph { font-size: 22px; }
body.dpd #statsGrid .dpc .stat-label { grid-area: label !important; align-self: center !important; font-size: 14.5px !important; font-weight: 600 !important; line-height: 1.25 !important; color: var(--dpc-text) !important; letter-spacing: -.005em; }
body.dpd #statsGrid .dpc .dpc-sub { display: block; margin-top: 3px; font-size: 12px; font-weight: 500; color: var(--dpc-muted); }
body.dpd #statsGrid .dpc .dpc-aux { grid-area: aux; align-self: start; justify-self: end; }
.dpc-info { display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; font-size: 17px; color: #7f9cc9; cursor: help; }
html[data-theme="light"] .dpc-info { color: #5f86c9; }
.dpc-badge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-size: 17px; color: var(--dpc-c); background: var(--dpc-t); }
body.dpd #statsGrid .dpc .stat-value { grid-area: value !important; margin: 18px 0 0 !important; font-size: clamp(20px, 13cqi, 30px) !important; font-weight: 800 !important; letter-spacing: -.03em !important; line-height: 1.1 !important; color: var(--dpc-title) !important; }
body.dpd #statsGrid .dpc .stat-change { grid-area: chip !important; justify-self: start !important; margin-top: 12px !important; padding: 4px 10px !important; border-radius: 999px !important; font-size: 13px !important; font-weight: 700 !important; gap: 6px !important; }
body.dpd #statsGrid .dpc .stat-change.up { background: rgba(34, 197, 94, .13) !important; color: #16a34a !important; }
body.dpd #statsGrid .dpc .stat-change.down { background: rgba(239, 68, 68, .12) !important; color: #dc2626 !important; }
html:not([data-theme="light"]) body.dpd #statsGrid .dpc .stat-change.up { color: #4ade80 !important; }
html:not([data-theme="light"]) body.dpd #statsGrid .dpc .stat-change.down { color: #f87171 !important; }
body.dpd #statsGrid .dpc .dpd-spark { grid-area: foot !important; align-self: end !important; justify-self: stretch !important; position: static !important; display: block; width: 100% !important; max-width: none !important; height: 46px !important; margin: 8px 0 0 !important; color: var(--dpc-s, var(--dpc-blue)) !important; opacity: 1 !important; overflow: visible; }
body.dpd #statsGrid .dpc .dpd-link { grid-area: foot !important; align-self: end !important; justify-self: start !important; margin: 18px 0 4px !important; gap: 9px; font-size: 14.5px !important; font-weight: 600 !important; color: var(--dpc-link) !important; opacity: 1 !important; }
body.dpd #statsGrid .dpc .dpd-link i { font-size: 13px; }

/* Barra de cima: data, "Atualizado às" e Hoje / Semana / Mês */
body.dpd .page-content > .toolbar { align-items: center !important; margin-bottom: 18px !important; }
body.dpd .page-content > .toolbar .toolbar-left > span { font-size: 14.5px !important; color: var(--dpc-muted) !important; }
body.dpd .page-content > .toolbar .toolbar-left > span > i { font-size: 17px; vertical-align: -2px; }
body.dpd .page-content > .toolbar .toolbar-left > span strong { color: var(--dpc-title) !important; font-weight: 700; }
body.dpd .dpd-stamp { height: 34px; padding: 0 14px; background: var(--dpc-bg); border-color: var(--dpc-line); box-shadow: var(--dpc-shadow); color: var(--dpc-muted); font-size: 13px; }
body.dpd .period-buttons-wrap { gap: 10px !important; }
body.dpd .period-buttons-wrap .period-btn { height: 40px !important; min-height: 40px; padding: 0 18px !important; border-radius: 10px !important; font-size: 14px !important; font-weight: 600 !important; background: var(--dpc-bg) !important; border: 1px solid var(--dpc-line) !important; color: var(--dpc-text) !important; box-shadow: var(--dpc-shadow) !important; }
body.dpd .period-buttons-wrap .period-btn.active { background: var(--dpc-blue) !important; border-color: var(--dpc-blue) !important; color: #fff !important; box-shadow: 0 8px 18px -8px rgba(31, 94, 255, .75) !important; }

@media (max-width: 1279px) {
  body.dpd #statsGrid { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
  body.dpd #statsGrid > .stat-card { grid-column: span 2 !important; }
  body.dpd #statsGrid > .stat-card:nth-child(n+4) { grid-column: span 3 !important; }
}
@media (max-width: 760px) {
  body.dpd #statsGrid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  body.dpd #statsGrid > .stat-card, body.dpd #statsGrid > .stat-card:nth-child(n+4) { grid-column: span 1 !important; }
  body.dpd #statsGrid > .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1 !important; }
  /* celular: card estreito, o nome vai para baixo do ícone (não quebra no meio da palavra) */
  body.dpd #statsGrid > .stat-card.dpc { grid-template-rows: auto auto auto auto 1fr !important; grid-template-areas: "icon . aux" "label label label" "value value value" "chip chip chip" "foot foot foot" !important;
    padding: 14px 14px 10px !important; column-gap: 10px !important; border-radius: 16px !important; }
  body.dpd #statsGrid .dpc .stat-icon { width: 36px !important; height: 36px !important; border-radius: 10px !important; font-size: 18px !important; }
  body.dpd #statsGrid .dpc .stat-label { margin-top: 10px !important; font-size: 13px !important; overflow-wrap: normal !important; word-break: normal !important; }
  body.dpd #statsGrid .dpc .dpc-sub { margin-top: 2px; font-size: 11.5px; }
  body.dpd #statsGrid .dpc .stat-value { margin-top: 12px !important; }
  body.dpd #statsGrid .dpc .stat-change { margin-top: 8px !important; font-size: 12px !important; }
  body.dpd #statsGrid .dpc .dpd-spark { height: 36px !important; }
  body.dpd #statsGrid .dpc .dpd-link { margin-top: 12px !important; font-size: 13px !important; }
  .dpc-badge { width: 28px; height: 28px; border-radius: 8px; font-size: 14px; }
  .dpc-info { font-size: 15px; }
  body.dpd .period-buttons-wrap .period-btn { height: 36px !important; min-height: 36px; padding: 0 14px !important; }
}
