/* Shared look for the Quotation / Job Order / Sales Order overview dashboards. Copied from
   PurchaseOverview.razor.css (pov- renamed to ovd-) as a global sheet so all three pages share one copy. */
/* Plain wrapper so every rule (including ) has a scoped ancestor. */
.ovd-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

/* ---- KPI tiles: white cards, tinted icon tile per metric ---- */
.ovd-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

@media (max-width: 1300px) {
    .ovd-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

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

@media (max-width: 480px) {
    .ovd-stats { grid-template-columns: minmax(0, 1fr); }
}

.ovd-stat {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--colorNeutralStroke2, #e5e7eb);
    border-radius: 10px;
    background: var(--colorNeutralBackground1, #fff);
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
    min-width: 0;
}

.ovd-stat:hover { border-color: var(--ovd-ink); }

.ovd-stat--blue { --ovd-tile: #dbe9fd; --ovd-ink: #2563eb; }
.ovd-stat--red { --ovd-tile: #fde2e2; --ovd-ink: #dc2626; }
.ovd-stat--indigo { --ovd-tile: #e0e7ff; --ovd-ink: #4f46e5; }
.ovd-stat--green { --ovd-tile: #d8f1e0; --ovd-ink: #16a34a; }
.ovd-stat--purple { --ovd-tile: #ede4fd; --ovd-ink: #7c3aed; }

.ovd-stat-icon {
    display: grid;
    place-items: center;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: var(--ovd-tile);
}

.ovd-stat-icon svg { fill: var(--ovd-ink); }

.ovd-stat-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.3; }

.ovd-stat-title { font-size: 13px; color: var(--colorNeutralForeground2, #424242); }

.ovd-stat-value { font-size: 26px; font-weight: 700; color: var(--colorNeutralForeground1, #1f2937); }

.ovd-stat-sub { font-size: 12px; color: var(--colorNeutralForeground3, #6b7280); }

.ovd-bad { color: #dc2626 !important; font-weight: 600; }

/* ---- Rows of cards ---- */
.ovd-row { display: grid; gap: 14px; align-items: stretch; }

.ovd-row--charts { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); }
.ovd-row--two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ovd-row--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 1200px) {
    .ovd-row--charts,
    .ovd-row--three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 800px) {
    .ovd-row--charts,
    .ovd-row--two,
    .ovd-row--three { grid-template-columns: minmax(0, 1fr); }
}

.ovd-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    border: 1px solid var(--colorNeutralStroke2, #e5e7eb);
    border-radius: 16px;
    background: var(--colorNeutralBackground1, #fff);
    min-width: 0;
}

.ovd-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 32px;
}

.ovd-card-title { font-size: 15px; font-weight: 700; }

.ovd-hint { font-size: 12px; color: var(--colorNeutralForeground3, #6b7280); }

.ovd-empty {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 12px;
    font-size: 13px;
    text-align: center;
    color: var(--colorNeutralForeground3, #6b7280);
}

.ovd-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--colorBrandForegroundLink, #0f6cbd);
    cursor: pointer;
}

.ovd-link:hover { text-decoration: underline; }

/* ---- Donut ---- */
.ovd-donut-row { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; flex: 1 1 auto; }

.ovd-donut {
    display: grid;
    place-items: center;
    flex: 0 0 150px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
}

.ovd-donut-hole {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--colorNeutralBackground1, #fff);
}

.ovd-donut-value { font-size: 24px; font-weight: 700; line-height: 1; }

.ovd-donut-label { font-size: 12px; color: var(--colorNeutralForeground3, #6b7280); }

.ovd-legend { display: flex; flex: 1 1 160px; flex-direction: column; gap: 8px; min-width: 0; }

.ovd-legend-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }

.ovd-dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; }

.ovd-legend-name { flex: 1 1 auto; min-width: 0; color: var(--colorNeutralForeground2, #424242); }

.ovd-legend-value { font-weight: 600; white-space: nowrap; }

/* ---- AP aging: vertical bars ---- */
.ovd-aging {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    flex: 1 1 auto;
    min-height: 200px;
}

.ovd-aging-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }

.ovd-aging-amount { font-size: 12px; font-weight: 700; white-space: nowrap; }

.ovd-aging-track {
    display: flex;
    flex: 1 1 auto;
    align-items: flex-end;
    width: 100%;
    max-width: 64px;
    border-bottom: 1px solid var(--colorNeutralStroke2, #e5e7eb);
}

.ovd-aging-bar { display: block; width: 100%; border-radius: 4px 4px 0 0; }

.ovd-aging-label { font-size: 12px; text-align: center; color: var(--colorNeutralForeground3, #6b7280); }

/* ---- Top suppliers: horizontal bars ---- */
.ovd-bars { display: flex; flex-direction: column; gap: 12px; }

.ovd-bar-row {
    display: grid;
    grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.ovd-bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ovd-bar-track { height: 18px; overflow: hidden; border-radius: 4px; background: var(--colorNeutralBackground3, #f0f2f5); }

.ovd-bar-fill { display: block; height: 100%; border-radius: 4px; background: #60a5fa; }

.ovd-bar-value { font-weight: 700; white-space: nowrap; }

/* ---- Alerts ---- */
.ovd-alert-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.ovd-alert-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid;
    border-radius: 8px;
    font-size: 12px;
}

.ovd-alert-chip strong { font-size: 20px; }

.ovd-alert-chip--urgent { border-color: #fbd0d0; background: #fef4f4; }
.ovd-alert-chip--urgent strong { color: #dc2626; }
.ovd-alert-chip--soon { border-color: #fde5b4; background: #fffaf0; }
.ovd-alert-chip--soon strong { color: #d97706; }
.ovd-alert-chip--pending { border-color: #d6e4fb; background: #f3f7fe; }
.ovd-alert-chip--pending strong { color: #2563eb; }

.ovd-alerts { display: flex; flex-direction: column; border: 1px solid var(--colorNeutralStroke2, #e5e7eb); border-radius: 8px; }

.ovd-alert {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto 16px;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid var(--colorNeutralStroke3, #f0f0f0);
    background: none;
    font: inherit;
    font-size: 13px;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.ovd-alert:last-child { border-bottom: 0; }
.ovd-alert:hover { background: var(--colorNeutralBackground2, #fafafa); }

.ovd-alert-count { font-size: 15px; font-weight: 700; text-align: center; }
.ovd-alert-count--urgent { color: #dc2626; }
.ovd-alert-count--soon { color: #d97706; }
.ovd-alert-count--pending { color: #2563eb; }

.ovd-alert-text { min-width: 0; }

.ovd-alert-tag { padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ovd-alert-tag--urgent { background: #fde2e2; color: #b42318; }
.ovd-alert-tag--soon { background: #fef3c7; color: #b45309; }
.ovd-alert-tag--pending { background: #e0ecfe; color: #1d4ed8; }

/* ---- Tables ---- */
.ovd-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }

.ovd-table th {
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    color: var(--colorNeutralForeground3, #6b7280);
    border-bottom: 1px solid var(--colorNeutralStroke2, #e5e7eb);
}

.ovd-table td { padding: 8px; border-bottom: 1px solid var(--colorNeutralStroke3, #f0f0f0); vertical-align: middle; }

.ovd-table tbody tr:last-child td { border-bottom: 0; }

.ovd-num { text-align: right !important; white-space: nowrap; }

.ovd-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ovd-click { cursor: pointer; }
.ovd-click:hover td { background: var(--colorNeutralBackground2, #fafafa); }

.ovd-due { padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.ovd-due--overdue { background: #fde2e2; color: #b42318; }
.ovd-due--soon { background: #fef3c7; color: #b45309; }
.ovd-due--upcoming { background: #e0ecfe; color: #1d4ed8; }
