/* EgyPrint Dashboard — Counter Ledger design tokens */

.fi-body:has(.fi-dashboard-page),
.fi-body:has(.fi-dashboard-page) .fi-main,
.fi-body:has(.fi-dashboard-page) .fi-page {
    background-color: #f9fafb !important;
}

.dark .fi-body:has(.fi-dashboard-page),
.dark .fi-body:has(.fi-dashboard-page) .fi-main,
.dark .fi-body:has(.fi-dashboard-page) .fi-page {
    background-color: #111827 !important;
}

.fi-dashboard-page .fi-page-header,
.fi-dashboard-page .fi-header {
    display: none !important;
}

.fi-dashboard-page .fi-page > section {
    row-gap: 1rem !important;
    padding-top: 0.75rem !important;
    padding-bottom: 1rem !important;
}

.fi-dashboard-page .fi-wi {
    gap: 1rem !important;
}

.fi-dashboard-page .fi-wi-widget {
    height: 100%;
}

/* Hero header */
.ep-dash-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    background: #ffffff;
    outline: 1px solid rgb(3 7 18 / 0.05);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

.dark .ep-dash-hero {
    background: #1f2937;
    outline-color: rgb(255 255 255 / 0.06);
}

.ep-dash-hero__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.25;
}

.dark .ep-dash-hero__title {
    color: #f9fafb;
}

.ep-dash-hero__welcome {
    margin: 0.375rem 0 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.ep-dash-hero__welcome strong {
    color: #374151;
    font-weight: 600;
}

.dark .ep-dash-hero__welcome {
    color: #9ca3af;
}

.dark .ep-dash-hero__welcome strong {
    color: #e5e7eb;
}

.ep-dash-hero__aside {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ep-dash-hero__date {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
}

.dark .ep-dash-hero__date {
    color: #9ca3af;
}

.ep-dash-hero__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: #ea580c;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Panel */
.ep-dash-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 12px;
    background: #ffffff;
    outline: 1px solid rgb(3 7 18 / 0.05);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
    overflow: hidden;
}

.dark .ep-dash-panel {
    background: #1f2937;
    outline-color: rgb(255 255 255 / 0.06);
}

.ep-dash-panel__head {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid #f3f4f6;
}

.dark .ep-dash-panel__head {
    border-bottom-color: #374151;
}

.ep-dash-panel__title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #111827;
}

.dark .ep-dash-panel__title {
    color: #f3f4f6;
}

.ep-dash-panel__body {
    flex: 1;
    padding: 1rem 1.25rem 1.25rem;
}

/* Metrics grid — ds-section mini cards */
.ep-dash-metrics {
    display: grid;
    gap: 0.75rem;
}

.ep-dash-metrics--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ep-dash-metrics--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 767px) {
    .ep-dash-metrics--2,
    .ep-dash-metrics--3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 479px) {
    .ep-dash-metrics--2,
    .ep-dash-metrics--3 {
        grid-template-columns: 1fr;
    }
}

.ep-dash-metric {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    background: #f9fafb;
    outline: 1px solid #e5e7eb;
    text-align: right;
}

.dark .ep-dash-metric {
    background: #111827;
    outline-color: #374151;
}

.ep-dash-metric__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    line-height: 1.35;
}

.dark .ep-dash-metric__label {
    color: #9ca3af;
}

.ep-dash-metric__value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    word-break: break-word;
}

.dark .ep-dash-metric__value {
    color: #f9fafb;
}

.ep-dash-metric[data-variant="success"] .ep-dash-metric__value { color: #16a34a; }
.ep-dash-metric[data-variant="danger"]  .ep-dash-metric__value { color: #dc2626; }
.ep-dash-metric[data-variant="warning"] .ep-dash-metric__value { color: #d97706; }

.dark .ep-dash-metric[data-variant="success"] .ep-dash-metric__value { color: #4ade80; }
.dark .ep-dash-metric[data-variant="danger"]  .ep-dash-metric__value { color: #f87171; }
.dark .ep-dash-metric[data-variant="warning"] .ep-dash-metric__value { color: #fbbf24; }

/* Alerts row */
.ep-dash-alerts {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1023px) {
    .ep-dash-alerts { grid-template-columns: 1fr; }
}

.ep-dash-alert {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
    gap: 0.125rem 0.625rem;
    padding: 1rem 1.125rem;
    border-radius: 12px;
    background: #f9fafb;
    outline: 1px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
    transition: outline-color 0.15s ease, background 0.15s ease;
}

a.ep-dash-alert:hover {
    background: #fff7ed;
    outline-color: #fed7aa;
}

.dark .ep-dash-alert {
    background: #111827;
    outline-color: #374151;
}

.dark a.ep-dash-alert:hover {
    background: rgb(124 45 18 / 0.25);
    outline-color: #9a3412;
}

.ep-dash-alert__count {
    grid-row: 1 / span 3;
    align-self: start;
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #111827;
    line-height: 1;
}

.dark .ep-dash-alert__count {
    color: #f9fafb;
}

.ep-dash-alert--danger  .ep-dash-alert__count { color: #dc2626; }
.ep-dash-alert--warning .ep-dash-alert__count { color: #d97706; }

.ep-dash-alert__title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #111827;
}

.dark .ep-dash-alert__title {
    color: #f3f4f6;
}

.ep-dash-alert__preview {
    grid-column: 2;
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .ep-dash-alert__preview {
    color: #9ca3af;
}

.ep-dash-alert__action {
    grid-column: 2;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ea580c;
}

/* Tables */
.ep-dash-table-title {
    margin: 1.25rem 0 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b7280;
}

.dark .ep-dash-table-title {
    color: #9ca3af;
}

.ep-dash-table-wrap {
    overflow: hidden;
    border-radius: 12px;
    outline: 1px solid #e5e7eb;
}

.dark .ep-dash-table-wrap {
    outline-color: #374151;
}

.ep-dash-table-scroll {
    overflow-x: auto;
}

.ep-dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: right;
}

.ep-dash-table thead tr {
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
}

.dark .ep-dash-table thead tr {
    background: #111827;
    border-bottom-color: #374151;
}

.ep-dash-table th {
    padding: 0.625rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}

.dark .ep-dash-table th {
    color: #9ca3af;
}

.ep-dash-table td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}

.dark .ep-dash-table td {
    border-bottom-color: #374151;
    color: #d1d5db;
}

.ep-dash-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.dark .ep-dash-table tbody tr:nth-child(even) {
    background: rgb(17 24 39 / 0.5);
}

.ep-dash-table tbody tr:last-child td {
    border-bottom: none;
}

.ep-dash-table__row--danger {
    background: #fef2f2 !important;
}

.dark .ep-dash-table__row--danger {
    background: rgb(69 10 10 / 0.35) !important;
}

.ep-dash-table__num {
    width: 2.5rem;
    color: #9ca3af !important;
    font-variant-numeric: tabular-nums;
}

.ep-dash-table__name {
    font-weight: 600;
    color: #111827 !important;
}

.dark .ep-dash-table__name {
    color: #f9fafb !important;
}

.ep-dash-table__amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: left;
}

.ep-dash-table__amount--danger {
    color: #dc2626 !important;
}

.ep-dash-table__muted {
    color: #6b7280 !important;
    font-variant-numeric: tabular-nums;
}

.ep-dash-empty {
    margin: 0;
    padding: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
    border-radius: 12px;
    background: #f9fafb;
    outline: 1px dashed #d1d5db;
}

.dark .ep-dash-empty {
    color: #9ca3af;
    background: #111827;
    outline-color: #4b5563;
}
