/* Painel de Controle no visual "Portu" (resources/views/filament/pages/dashboard.blade.php e
   resources/views/filament/widgets/pd/*). Tudo prefixado com `pd-` para não esbarrar no Filament.
   Cores: as da logo do SP Certificados (verde-azulado #065a62, dourado #ca922a). */

.pd {
    --pd-main: #065a62;
    --pd-deep: #033a40;
    --pd-gold: #ca922a;
    --pd-card: #ffffff;
    --pd-soft: #eef4f4;
    --pd-line: #e4ecec;
    --pd-muted: rgba(6, 90, 98, 0.6);
    --pd-shadow: 0 1px 2px rgba(6, 90, 98, 0.05), 0 8px 24px rgba(6, 90, 98, 0.06);
    font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--pd-main);
}

.dark .pd {
    --pd-main: #8fd3d9;
    --pd-deep: #bfe6e9;
    --pd-card: #0f1c1e;
    --pd-soft: rgba(255, 255, 255, 0.05);
    --pd-line: rgba(255, 255, 255, 0.08);
    --pd-muted: rgba(220, 240, 242, 0.55);
    --pd-shadow: none;
}

/* ===== Estrutura ===== */
.pd-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
.pd-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 28px; align-items: start; }
.pd-side .pd-block + .pd-block { margin-top: 0; }

@media (min-width: 1400px) {
    .pd-layout { grid-template-columns: minmax(0, 1fr) 300px; }
    .pd-side { display: block; }
    .pd-side .pd-block + .pd-block { margin-top: 30px; }
}

/* ===== Cartão ===== */
.pd-card {
    height: 100%;
    background: var(--pd-card);
    border-radius: 14px;
    box-shadow: var(--pd-shadow);
    padding: 22px;
}

.pd-h2 { font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.pd-h3 { font-size: 16px; font-weight: 600; line-height: 1.3; }
.pd-sub { margin-top: 4px; font-size: 13px; }
.pd-muted { color: var(--pd-muted); }
.pd-row { display: flex; align-items: center; gap: 14px; }
.pd-between { justify-content: space-between; }
.pd-rel { position: relative; }
.pd-empty { margin-top: 18px; font-size: 14px; }

.pd-example {
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--pd-soft);
    color: var(--pd-muted);
    font-size: 11px;
    font-weight: 500;
    vertical-align: 2px;
}

/* ===== Gráficos (SVG) ===== */
.pd-chart { display: block; width: 100%; height: auto; overflow: visible; }
.pd-chart text { fill: var(--pd-muted); font-size: var(--pd-chart-font, 19px); font-family: inherit; }
.pd-chart .pd-grid { stroke: var(--pd-line); stroke-width: 1; fill: none; }
.pd-chart .pd-hit { cursor: crosshair; }

.pd-tip {
    position: absolute;
    z-index: 5;
    transform: translate(-50%, calc(-100% - 12px));
    padding: 8px 14px;
    border-radius: 9px;
    background: var(--pd-main);
    color: #fff;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
}
.dark .pd-tip { color: #05262a; }
.pd-tip b { display: block; font-size: 13px; font-weight: 600; }
.pd-tip::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -6px;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom: 0;
    border-top-color: var(--pd-main);
}
.pd-tip.is-static span { font-weight: 400; }

/* ===== Indicadores ===== */
.pd-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding: 20px 28px; }
.pd-stat { display: flex; align-items: center; gap: 16px; min-width: 0; }
.pd-stat-box {
    display: grid;
    place-items: center;
    flex: none;
    width: 52px;
    height: 52px;
    border: 1.5px solid var(--pd-main);
    border-radius: 15px;
    color: var(--pd-main);
}
.pd-stat-box.is-gold { border-color: var(--pd-gold); color: var(--pd-gold); }
.pd-stat-box .pd-ico { width: 24px; height: 24px; }
.pd-stat-text { min-width: 0; }
.pd-stat-text small { display: block; font-size: 13px; color: var(--pd-muted); white-space: nowrap; }
.pd-stat-text b { display: block; font-size: clamp(20px, 1.9vw, 27px); font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 1100px) { .pd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .pd-stats { grid-template-columns: minmax(0, 1fr); } }

/* ===== Rosca ("Device") ===== */
.pd-donut { width: 186px; max-width: 70%; margin: 22px auto 0; }
.pd-legend { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 9px; }
.pd-legend li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13px; }
.pd-legend b { font-size: 14px; font-weight: 600; white-space: nowrap; }
.pd-legend em { font-style: normal; font-weight: 400; font-size: 12px; color: var(--pd-muted); }
.pd-legend-label { display: inline-flex; align-items: center; color: var(--pd-muted); }
.pd-legend-label i, .pd-legend-inline i {
    display: inline-block;
    flex: none;
    width: 9px;
    height: 9px;
    margin-right: 8px;
    border: 2.5px solid;
    border-radius: 50%;
}
.pd-legend-inline { display: flex; gap: 18px; font-size: 12px; color: var(--pd-muted); }

.pd-donut-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 8px; }
@media (min-width: 768px) { .pd-donut-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; } }
.pd-donut-card.is-inner { padding: 14px 0 0; }
.pd-donut-card.is-inner .pd-h3 { text-align: center; color: var(--pd-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

/* ===== Linhas ("Visitor Rate") ===== */
.pd-period { font-size: 12px; color: var(--pd-muted); }
.pd-trend-head { margin-top: 18px; align-items: flex-start; flex-wrap: wrap; }
.pd-trend-total { display: flex; align-items: center; gap: 12px; }
.pd-trend-total .pd-ico { width: 26px; height: 26px; }
.pd-trend-total small, .pd-trend-legend span { display: block; font-size: 12px; color: var(--pd-muted); }
.pd-trend-total b, .pd-trend-legend b { display: block; font-size: 14px; font-weight: 500; }
.pd-trend-legend { gap: 28px; align-items: flex-start; }
.pd-trend-chart { margin-top: 14px; }
.pd-visitors { margin-top: 16px; }

/* ===== Tabelas ("Lastest Invoice") ===== */
.pd-table-card { padding-bottom: 12px; }
.pd-table-wrap { margin: 14px -22px 0; overflow-x: auto; }
.pd-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pd-table th { padding: 0 22px 12px; text-align: left; font-size: 12px; font-weight: 600; color: var(--pd-muted); white-space: nowrap; }
.pd-table td { padding: 12px 22px; border-top: 1px solid var(--pd-line); vertical-align: middle; }
.pd-table tbody tr { transition: background-color .12s; }
.pd-table tbody tr:hover { background: var(--pd-soft); }
.pd-table .is-right { text-align: right; }
.pd-table .is-narrow { width: 46px; }
.pd-table td b { font-weight: 600; }
.pd-who { display: flex; align-items: center; gap: 13px; min-width: 0; }

.pd-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: #dcdcdc;
    color: #fff;
    font-weight: 600;
}
.dark .pd-avatar { background: rgba(255, 255, 255, 0.12); }
.pd-avatar.is-letter { background: var(--pd-main); font-size: 14px; }
.dark .pd-avatar.is-letter { background: rgba(143, 211, 217, 0.2); color: var(--pd-main); }
.pd-avatar.is-gold { background: var(--pd-gold); }
.pd-avatar .pd-ico { width: 19px; height: 19px; }

.pd-badge { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 8px; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; }

.pd-bar-cell { width: 34%; }
.pd-bar { height: 8px; border-radius: 6px; background: var(--pd-soft); overflow: hidden; }
.pd-bar i { display: block; height: 100%; border-radius: 6px; background: var(--pd-gold); }

/* ===== Coluna lateral de exemplo ===== */
.pd-block + .pd-block { margin-top: 30px; }
.pd-block .pd-h3 { font-size: 17px; font-weight: 700; }
.pd-spark { height: 78px; margin-top: 16px; }
.pd-spark .pd-chart { height: 100%; }
.pd-server { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; margin-top: 14px; font-size: 12px; }
.pd-server > div:first-child { padding-right: 16px; }
.pd-server > div + div { padding-left: 16px; border-left: 1px solid var(--pd-line); }
.pd-server-label { display: flex; align-items: center; gap: 4px; color: var(--pd-muted); }
.pd-server b { display: block; margin-top: 4px; font-size: 15px; font-weight: 600; }
.pd-server b em { font-style: normal; font-weight: 400; color: var(--pd-muted); }
.pd-server small { display: block; margin-top: 2px; font-size: 11px; color: var(--pd-muted); }

/* "?" que abre uma explicação ao clicar (Comparativo de Pedidos e Desempenho) */
.pd-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    padding: 0;
    border: 1px solid var(--pd-muted);
    border-radius: 50%;
    background: transparent;
    color: var(--pd-muted);
    font: inherit;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}
.pd-help:hover, .pd-help[aria-expanded='true'] { border-color: var(--pd-main); background: var(--pd-main); color: #fff; }
.dark .pd-help:hover, .dark .pd-help[aria-expanded='true'] { color: #05262a; }
.pd-help-pop {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 10;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 9px;
    background: var(--pd-main);
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    white-space: normal;
}
.dark .pd-help-pop { color: #05262a; }

.pd-list { list-style: none; margin: 10px 0 0; padding: 0; }
.pd-list li { border-bottom: 1px solid var(--pd-line); }
.pd-list li:last-child { border-bottom: 0; }
.pd-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; color: inherit; text-decoration: none; }
.pd-item:hover .pd-list-text b { text-decoration: underline; text-underline-offset: 2px; }
.pd-item-end { flex: none; text-align: right; }
.pd-item-end b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pd-item-end time { display: block; font-size: 11px; color: var(--pd-muted); }
.pd-list-text { min-width: 0; flex: 1; }
.pd-list-text b { display: block; font-size: 13px; font-weight: 600; }
.pd-list-text small { display: block; margin-top: 1px; font-size: 12px; color: var(--pd-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-list time { font-size: 11px; color: var(--pd-muted); }
.pd-mailbtn { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--pd-card); color: var(--pd-main); box-shadow: var(--pd-shadow); }
.pd-mailbtn .pd-ico { width: 16px; height: 16px; }
.pd-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    margin-top: 14px;
    border-radius: 12px;
    background: var(--pd-card);
    box-shadow: var(--pd-shadow);
    color: var(--pd-main);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
/* "+N" ao lado do botão: pendências que não cabem nos 3 itens da lista */
.pd-more-count { padding: 2px 8px; border-radius: 999px; background: var(--pd-gold); color: #fff; font-size: 12px; font-weight: 600; line-height: 1.3; }

@media (prefers-reduced-motion: reduce) { .pd-table tbody tr { transition: none; } }

/* Legenda abaixo do gráfico de média de certificados */
.pd-legend-bottom { margin-top: 12px; justify-content: center; }
.pd-legend-inline i.is-dash { width: 18px; height: 0; border: 0; border-top: 2px dashed var(--pd-main); border-radius: 0; margin-right: 8px; vertical-align: middle; }

/* ===== Filtros De / Até: pílulas minimalistas; ao clicar abre o calendário do Filament ===== */
.pd-main .fi-sc.fi-grid:has(> .fi-grid-col > .fi-sc-component > .fi-fo-field .fi-fo-date-time-picker) {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 18px;
}
.pd-main .fi-sc.fi-grid:has(> .fi-grid-col > .fi-sc-component > .fi-fo-field .fi-fo-date-time-picker) > .fi-grid-col { width: auto; flex: none; grid-column: auto; }

.pd-main .fi-input-wrp.fi-fo-date-time-picker {
    width: 172px;
    min-width: 0;
    min-height: 38px;
    border-radius: 12px;
    background: var(--pd-card);
    box-shadow: none !important;
    --tw-ring-shadow: 0 0 #0000 !important;
    border: 1px solid rgba(6, 90, 98, 0.22);
    color: var(--pd-main);
    cursor: pointer;
    transition: border-color .15s;
}
.pd-main .fi-input-wrp.fi-fo-date-time-picker:hover,
.pd-main .fi-input-wrp.fi-fo-date-time-picker:focus-within { border-color: var(--pd-main); }

.pd-main .fi-fo-date-time-picker .fi-input-wrp-prefix { border: 0 !important; padding-inline: 12px 0; }
.pd-main .fi-fo-date-time-picker .fi-input-wrp-content-ctn { min-width: 0; flex: 1; }
.pd-main .fi-fo-date-time-picker .fi-fo-date-time-picker-trigger { width: 100%; }
.pd-main .fi-fo-date-time-picker .fi-input-wrp-label { font-size: 12px; color: var(--pd-muted); }
.pd-main .fi-fo-date-time-picker .fi-fo-date-time-picker-display-text-input { font-size: 14px; font-weight: 500; color: var(--pd-main); cursor: pointer; }
.pd-main .fi-fo-date-time-picker .fi-input-wrp-suffix { padding-inline: 0 8px; color: var(--pd-muted); }

.pd-title-logo { display: flex; align-items: center; gap: 10px; }
.pd-soluti { display: block; height: 24px; width: auto; }

/* Legenda da cor da linha do Desempenho de Vendas */
.pd-trend-note { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--pd-muted); }
.pd-trend-note i { flex: none; width: 8px; height: 8px; border-radius: 50%; }

/* Espaço entre o cabeçalho e o conteúdo do Painel de Controle */
.pd-main > .fi-sc-component:first-child,
.pd-main > div:first-child { margin-top: 0; }

/* Título do Painel de Controle: na mesma linha dos filtros De/Até, à esquerda */
.pd-main { position: relative; }
.pd-page-title {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    height: 38px;
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--pd-main);
}
body.pd-dashboard .fi-header-heading { display: none !important; }
