/* Dashboard — layout e componentes */

.dash-layout {
    width: 100%;
    padding: 0 4px;
}

.dash-layout__grid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
    gap: 0;
}

.dash-layout__main {
    flex: 0 0 75%;
    max-width: 75%;
    padding: 0 12px;
}

.dash-layout__sidebar {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 0 12px;
}

.dash-layout__alert-row {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 12px;
}

/* Toolbar */
.dash-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
    padding: 14px 18px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8ecf0;
}

.dash-toolbar__label {
    flex: 0 0 auto;
    font-size: var(--text-base, 12px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #375a7f;
    white-space: nowrap;
}

.dash-toolbar__field {
    flex: 1 1 200px;
    min-width: 180px;
}

.dash-toolbar__field .form-control {
    height: 38px;
    border-radius: 8px;
    border-color: #dde1e5;
    font-size: var(--text-md, 13px);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dash-toolbar__field .form-control:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.12);
    outline: none;
}

.dash-columns {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
    gap: 0;
}

.dash-columns__item {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 12px;
}

.dash-divisor {
    margin: 4px 0 16px;
    border: 0;
    border-top: 1px solid #e8ecf0;
}

/* KPI counters */
.dash-counts {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
    width: 100%;
}

.dash-counts__item {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 0 8px;
    margin-bottom: 8px;
}

.dash-counts a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.dash-counts a:hover,
.dash-counts a:focus,
.dash-counts a:active,
.dash-counts a:visited {
    text-decoration: none;
    color: inherit;
}

.dash-card-counter {
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 18px 16px 18px 64px;
    background-color: #fff;
    min-height: 96px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dash-card-counter:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.dash-card-counter--primary {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: #fff;
    border-color: transparent;
}

.dash-card-counter--danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    border-color: transparent;
}

.dash-card-counter--warning {
    background: linear-gradient(135deg, #f39c12 0%, #d4860b 100%);
    color: #fff;
    border-color: transparent;
}

.dash-card-counter--success {
    background: linear-gradient(135deg, #18bc9c 0%, #149a80 100%);
    color: #fff;
    border-color: transparent;
}

.dash-card-counter--info {
    background: linear-gradient(135deg, #3498db 0%, #258cd1 100%);
    color: #fff;
    border-color: transparent;
}

.dash-card-counter i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.6em;
    opacity: 0.25;
    line-height: 1;
}

.dash-card-counter .count-numbers {
    position: relative;
    font-size: var(--text-3xl, 24px);
    font-weight: 700;
    display: block;
    text-align: right;
    line-height: 1.1;
    word-break: break-word;
}

.dash-card-counter .count-name {
    position: relative;
    margin-top: 4px;
    font-size: var(--text-base, 12px);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.9;
    display: block;
    text-align: right;
    line-height: 1.2;
}

/* Widget card */
.dash-card {
    margin-bottom: 20px;
    border: 1px solid #e8ecf0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.dash-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.dash-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #375a7f 0%, #2c3e50 100%);
    color: #fff;
}

.dash-card__header:has(.dash-card__link)::before {
    content: '';
    width: 28px;
    flex-shrink: 0;
}

.dash-card__title {
    flex: 1;
    margin: 0;
    font-size: var(--text-md, 13px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
}

.dash-card__link {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: rgba(255, 255, 255, 0.85);
    font-size: var(--text-base-lg, 14px);
    border-radius: 6px;
    text-decoration: none;
    transition: color 0.2s, background 0.2s;
}

.dash-card__link:hover,
.dash-card__link:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    text-decoration: none;
}

.dash-card--wide,
.dash-card--chart {
    margin-bottom: 20px;
}

.dash-card--interactive:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.dash-card__title--danger {
    color: #ff8a80;
}

.dash-card__body {
    padding: 20px;
}

.dash-card__body--flush {
    padding: 0;
}

.dash-card__body--empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 120px;
    color: #94a3b8;
    font-size: var(--text-base, 12px);
}

.dash-section {
    margin-bottom: 4px;
}

.dash-counts-section {
    margin-bottom: 16px;
}

/* KPI summary strip (análises e gráficos) */
.dash-evolution-summary {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    overflow: hidden;
}

.dash-evolution-summary__item {
    flex: 1 1 0;
    min-width: 130px;
    padding: 14px 10px;
    text-align: center;
    background: #fff;
    border-bottom: 4px solid transparent;
}

.dash-evolution-summary__item:not(:last-child) {
    border-right: 1px solid #e8ecf0;
}

.dash-evolution-summary__label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--text-xs, 10px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #7f8c9a;
    line-height: 1.3;
}

.dash-evolution-summary__item strong {
    display: block;
    font-size: var(--text-xl, 18px);
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
}

.dash-evolution-summary__item--blue {
    border-bottom-color: #4a90e2;
}

.dash-evolution-summary__item--green {
    border-bottom-color: #18bc9c;
}

.dash-evolution-summary__item--red {
    border-bottom-color: #e74c3c;
}

.dash-evolution-summary__item--muted {
    border-bottom-color: #95a5a6;
}

.dash-chart-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #fde68a;
    background: #fffbeb;
    color: #92400e;
    font-size: var(--text-sm, 11px);
    line-height: 1.4;
}

.dash-chart-alert .fa {
    margin-top: 2px;
    color: #f39c12;
}

.dash-chart-alert a {
    color: #b45309;
    font-weight: 600;
    text-decoration: underline;
}

.dash-chart-alert a:hover,
.dash-chart-alert a:focus {
    color: #92400e;
}

.dash-card__chart-area {
    padding: 12px 16px 16px;
    min-height: 200px;
}

.dash-card__chart-area--donut {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
}

.dash-card__chart-area--wide {
    padding: 12px 16px 16px;
}

.dash-card__table-toggle {
    border-top: 1px solid #e8ecf0;
}

.dash-card__toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    border: none;
    border-radius: 0;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: #375a7f;
    font-size: var(--text-sm, 11px);
    font-weight: 700;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.dash-card__toggle-btn:hover,
.dash-card__toggle-btn:focus {
    background: #eef2f6;
    color: #2c3e50;
    outline: none;
}

.dash-card__toggle-btn--active {
    background: #eef2f6;
    color: #2c3e50;
    box-shadow: inset 0 2px 0 #4a90e2;
}

.dash-card__toggle-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(55, 90, 127, 0.1);
    color: #375a7f;
    font-size: var(--text-sm, 11px);
    transition: background 0.2s, color 0.2s;
}

.dash-card__toggle-btn--active .dash-card__toggle-btn-icon {
    background: linear-gradient(135deg, #375a7f 0%, #2c3e50 100%);
    color: #fff;
}

.dash-card__toggle-btn-text {
    flex: 0 1 auto;
}

.dash-card__toggle-btn-chevron {
    font-size: var(--text-xs, 10px);
    opacity: 0.65;
    transition: transform 0.2s ease, opacity 0.2s;
}

.dash-card__toggle-btn:hover .dash-card__toggle-btn-chevron,
.dash-card__toggle-btn--active .dash-card__toggle-btn-chevron {
    opacity: 1;
}

.dash-card__table-area {
    padding: 12px 16px 16px;
    overflow-x: auto;
}

.dash-frappe-chart {
    width: 100%;
}

.dash-frappe-chart__loading,
.dash-frappe-chart__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: inherit;
    color: #94a3b8;
    font-size: var(--text-base, 12px);
}

.dash-frappe-chart__canvas {
    width: 100%;
}

/* Estatísticas em 3 colunas */
.dash-stats {
    display: flex;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: center;
}

.dash-stats__item {
    flex: 1 1 0;
    margin: 0;
    background-color: #f8f9fa;
    padding: 22px 12px;
    font-size: var(--text-base, 12px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #7f8c9a;
    border-bottom: 4px solid transparent;
    transition: background-color 0.2s;
}

.dash-stats__item:not(:first-child) {
    border-left: 1px solid #e8ecf0;
}

.dash-stats__item:hover {
    background-color: #f0f3f6;
}

.dash-stats__item h2 {
    font-weight: 700;
    margin: 8px 0 0;
    font-size: var(--text-4xl, 30px);
    color: #2c3e50;
    line-height: 1;
}

.dash-stats__item--green {
    border-bottom-color: #18bc9c;
}

.dash-stats__item--yellow {
    border-bottom-color: #f39c12;
}

.dash-stats__item--red {
    border-bottom-color: #e74c3c;
}

.dash-stats__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.dash-stats__link:hover,
.dash-stats__link:focus {
    color: inherit;
    text-decoration: none;
}

/* Legenda dos gráficos donut */
.dash-legend {
    margin: 0;
    padding: 12px 16px 16px;
    list-style: none;
    border-top: 1px solid #e8ecf0;
}

.dash-legend__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: var(--text-sm, 11px);
    color: #2c3e50;
}

.dash-legend__dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dash-legend__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-legend__count {
    flex-shrink: 0;
    font-weight: 700;
    color: #375a7f;
}

/* Tabela do dashboard */
.dash-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    font-size: var(--text-base, 12px);
}

.dash-table th,
.dash-table td {
    border: 1px solid #e8ecf0;
    padding: 9px 12px;
    vertical-align: middle;
}

.dash-table thead th {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: var(--text-sm, 11px);
    letter-spacing: 0.04em;
}

.dash-table tbody tr:hover td {
    background-color: #f8f9fa;
}

.dash-table--compact th,
.dash-table--compact td {
    padding: 6px 10px;
    font-size: var(--text-sm, 11px);
}

.dash-table tfoot td {
    background: #f0f3f6;
    font-weight: 700;
    border-top: 2px solid #dde1e5;
}

.dash-table tfoot tr:hover td {
    background: #f0f3f6;
}

.dash-table__cell--paid {
    background-color: #e8f5e9 !important;
    color: #2e7d32;
}

.dash-table__cell--right {
    text-align: right;
    font-weight: 600;
}

.dash-table__cell--center {
    text-align: center;
}

.dash-table__text--bold {
    font-weight: 700;
    color: #2c3e50;
}

.dash-table__text--upper {
    text-transform: uppercase;
}

.dash-chart-tip__meta {
    display: block;
    margin-top: 2px;
    font-size: var(--text-xs, 10px);
    font-weight: 400;
    color: #7f8c9a;
}

/* Botão de ação */
.dash-action-link {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #375a7f 0%, #2c3e50 100%);
    color: #fff;
    font-size: var(--text-sm, 11px);
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: opacity 0.2s, transform 0.2s;
}

.dash-action-link:hover,
.dash-action-link:focus {
    opacity: 0.9;
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

/* Gráfico frappe — responsivo */
.dash-chart .dash-card__body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-height: 280px;
}

.dash-chart #chart {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
}

.dash-chart .frappe-chart {
    height: auto !important;
    width: 100% !important;
    max-width: 280px;
}

.dash-chart .frappe-chart svg {
    max-width: 100%;
    height: auto;
}

/* Tabs da sidebar */
.dash-sidebar-tabs {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8ecf0;
    overflow: hidden;
}

.dash-sidebar-tabs .uk-tab {
    margin: 0;
    padding: 0;
    background: #f8f9fa;
    border-bottom: 1px solid #e8ecf0;
}

.dash-sidebar-tabs .uk-tab > li {
    flex: 1;
}

.dash-sidebar-tabs .uk-tab > li > a {
    padding: 10px 8px;
    font-size: var(--text-sm, 11px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #7f8c9a;
    border: none;
    text-align: center;
    transition: color 0.2s, background 0.2s;
}

.dash-sidebar-tabs .uk-tab > li.uk-active > a {
    color: #375a7f;
    background: #fff;
    border-bottom: 2px solid #4a90e2;
}

.dash-sidebar-tabs .uk-tab > li > a:hover {
    color: #375a7f;
    text-decoration: none;
}

.dash-sidebar-tabs .uk-switcher {
    padding: 0;
}

/* Prognóstico financeiro */
.prognostico-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

.prognostico-layout__calendar {
    flex: 1 1 520px;
    min-width: 300px;
}

.prognostico-layout__details {
    flex: 1 1 280px;
    max-width: 420px;
}

.prognostico-day-title {
    margin: 0 0 12px;
    font-size: var(--text-xl-lg, 20px);
}

.prognostico-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prognostico-empty {
    padding: 20px 0;
    color: #607d8b;
    font-size: var(--text-lg-md, 16px);
}

/* Responsivo */
@media (max-width: 1199px) {
    .dash-layout__main {
        flex: 0 0 70%;
        max-width: 70%;
    }

    .dash-layout__sidebar {
        flex: 0 0 30%;
        max-width: 30%;
    }
}

@media (max-width: 991px) {
    .dash-layout__main,
    .dash-layout__sidebar,
    .dash-columns__item {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .dash-counts__item {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .dash-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .dash-toolbar__label {
        text-align: left;
    }
}

@media (max-width: 575px) {
    .dash-counts__item {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .dash-stats {
        flex-direction: column;
    }

    .dash-stats__item:not(:first-child) {
        border-left: none;
        border-top: 1px solid #e8ecf0;
    }

    .dash-evolution-summary__item {
        flex: 1 1 50%;
        min-width: 0;
    }

    .dash-evolution-summary__item:nth-child(even) {
        border-right: none;
    }

    .dash-card-counter .count-numbers {
        font-size: var(--text-xl-lg, 20px);
    }
}

@media (max-width: 991px) {
    .prognostico-layout__details {
        max-width: none;
    }
}
