/*
 * Ops screens (22a / 22b): «الموقف التنفيذي», the unit status tab and the
 * site sheet import. Plain CSS on Filament's color variables (no build step),
 * registered with FilamentAsset in AppServiceProvider.
 */

.ops-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}

.dark .ops-card {
    background: var(--gray-900);
    border-color: rgb(255 255 255 / 0.1);
}

.ops-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Filters bar */
.ops-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: flex-end;
    padding: 1rem 1.25rem;
}

.ops-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.875rem;
}

.ops-field > span {
    color: var(--gray-600);
    font-weight: 500;
}

.dark .ops-field > span {
    color: var(--gray-400);
}

.ops-input {
    min-height: 2.6rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    background: #fff;
    color: inherit;
    font-size: 0.9rem;
    min-width: 6rem;
}

.ops-input:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: -1px;
}

.dark .ops-input {
    background: rgb(255 255 255 / 0.05);
    border-color: rgb(255 255 255 / 0.15);
}

.ops-input.is-wide {
    min-width: 15rem;
}

.ops-input.is-medium {
    min-width: 9rem;
}

/* The matrix filters: one row on wide screens, like the static page */
.ops-filters.is-grid {
    display: grid;
    grid-template-columns: minmax(14rem, 2.4fr) repeat(5, minmax(6rem, 1fr));
}

.ops-filters.is-grid .ops-input {
    width: 100%;
    min-width: 0;
}

@media (max-width: 1100px) {
    .ops-filters.is-grid {
        grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    }
}

/* Summary tiles */
.ops-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: 0.75rem;
}

.ops-tile {
    padding: 0.9rem 1rem;
}

.ops-tile-label {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.ops-tile-value {
    margin-top: 0.6rem;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.ops-tile.is-success .ops-tile-value { color: var(--success-600); }
.ops-tile.is-warning .ops-tile-value { color: var(--warning-600); }
.ops-tile.is-danger .ops-tile-value { color: var(--danger-600); }

/* Progress */
.ops-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.ops-progress-track {
    flex: 1;
    height: 0.5rem;
    border-radius: 999px;
    background: var(--gray-200);
    overflow: hidden;
}

.dark .ops-progress-track {
    background: rgb(255 255 255 / 0.1);
}

.ops-progress-bar {
    height: 100%;
    border-radius: 999px;
    background: var(--success-500);
}

/* Tables */
.ops-scroll {
    overflow: auto;
    max-height: calc(100vh - 14rem);
}

.ops-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.ops-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0.7rem 0.45rem;
    background: #f7f9fb;
    color: var(--h-navy, #1a3a5c);
    border-bottom: 2px solid var(--h-line, #dde3ea);
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.dark .ops-table th {
    color: var(--gray-200);
    background: var(--gray-800);
    border-color: rgb(255 255 255 / 0.1);
}

.ops-table th.is-start,
.ops-table td.is-start {
    text-align: start;
}

.ops-table th.is-handover {
    background: var(--warning-50);
    color: var(--warning-800);
}

.dark .ops-table th.is-handover {
    background: color-mix(in oklab, var(--warning-400) 20%, var(--gray-800));
    color: var(--warning-300);
}

.ops-table td {
    padding: 0.65rem 0.45rem;
    border-bottom: 1px solid var(--gray-100);
    text-align: center;
    white-space: nowrap;
}

.dark .ops-table td {
    border-color: rgb(255 255 255 / 0.06);
}

.ops-table tbody tr:hover td {
    filter: brightness(0.97);
}

.ops-table td.is-muted {
    color: var(--gray-400);
}

.ops-table td.is-notes {
    text-align: start;
    white-space: normal;
    min-width: 9rem;
}

.ops-table td.is-number {
    font-variant-numeric: tabular-nums;
}

.ops-table .ops-link {
    color: var(--primary-600);
    font-weight: 700;
}

.dark .ops-table .ops-link {
    color: var(--primary-400);
}

/* Matrix cells by state color */
.ops-cell {
    font-weight: 500;
}

.ops-cell.is-clickable {
    cursor: pointer;
}

.ops-cell.is-clickable:hover {
    box-shadow: inset 0 0 0 2px var(--primary-500);
}

.ops-cell.is-success {
    background: var(--success-50);
    color: var(--success-700);
}

.ops-cell.is-warning {
    background: var(--warning-50);
    color: var(--warning-700);
}

.ops-cell.is-danger {
    background: var(--danger-50);
    color: var(--danger-700);
}

.dark .ops-cell.is-success {
    background: color-mix(in oklab, var(--success-500) 15%, transparent);
    color: var(--success-300);
}

.dark .ops-cell.is-warning {
    background: color-mix(in oklab, var(--warning-500) 15%, transparent);
    color: var(--warning-300);
}

.dark .ops-cell.is-danger {
    background: color-mix(in oklab, var(--danger-500) 15%, transparent);
    color: var(--danger-300);
}

.ops-late {
    display: inline-block;
    margin-inline-start: 0.4rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--danger-50);
    color: var(--danger-700);
    font-size: 0.75rem;
    font-weight: 600;
}

.ops-empty {
    padding: 2rem;
    text-align: center;
    color: var(--gray-500);
}

/* Section headings and notes */
.ops-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.ops-muted {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.ops-pad {
    padding: 1rem 1.25rem;
}

.ops-alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.ops-alert.is-warning { background: var(--warning-50); color: var(--warning-800); }
.ops-alert.is-danger { background: var(--danger-50); color: var(--danger-800); }
.ops-alert.is-info { background: var(--gray-50); color: var(--gray-700); }

.dark .ops-alert.is-warning { background: color-mix(in oklab, var(--warning-500) 15%, transparent); color: var(--warning-300); }
.dark .ops-alert.is-danger { background: color-mix(in oklab, var(--danger-500) 15%, transparent); color: var(--danger-300); }
.dark .ops-alert.is-info { background: rgb(255 255 255 / 0.05); color: var(--gray-300); }

@media print {
    .ops-no-print,
    .fi-sidebar,
    .fi-topbar,
    .fi-header-actions {
        display: none !important;
    }

    .ops-scroll {
        max-height: none;
        overflow: visible;
    }

    .ops-table th {
        position: static;
    }
}

/* Attendance month grid (16c2) */
.ops-table th.is-off,
.ops-table td.is-off {
    background: var(--h-navy-soft, #eaf1f8);
}

.dark .ops-table th.is-off,
.dark .ops-table td.is-off {
    background: rgb(255 255 255 / 0.04);
}

.ops-table .ops-sticky-start {
    position: sticky;
    inset-inline-start: 0;
    z-index: 1;
    background: #fff;
}

.ops-table th.ops-sticky-start {
    z-index: 3;
    background: #f7f9fb;
}

.dark .ops-table .ops-sticky-start {
    background: var(--gray-900);
}

.dark .ops-table th.ops-sticky-start {
    background: var(--gray-800);
}

.ops-grid-select {
    width: 100%;
    min-width: 2.4rem;
    padding: 0.25rem 0;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    appearance: none;
    cursor: pointer;
}

.ops-grid-select:hover,
.ops-grid-select:focus {
    border-color: var(--h-navy, #1a3a5c);
    outline: none;
}

.ops-grid-select:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Tabs (static .tabs) */
.ops-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--h-line, #dde3ea);
}

.ops-tabs button {
    padding: 0.55rem 1.1rem;
    border: 0;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    background: transparent;
    color: var(--gray-500);
    font-weight: 600;
    cursor: pointer;
}

.ops-tabs button.is-active {
    color: var(--h-navy, #1a3a5c);
    border-bottom-color: var(--h-gold, #f5a623);
}

.dark .ops-tabs button.is-active {
    color: #fff;
}

/* Supply grid: item headers wrap, sum rows shaded (static .sp-h / tr.sum) */
.ops-table th.ops-item-head {
    white-space: normal;
    min-width: 6rem;
    max-width: 8rem;
    font-size: 0.75rem;
    line-height: 1.35;
    vertical-align: bottom;
}

.ops-table th.ops-item-head .ops-muted {
    display: block;
    font-weight: 400;
    font-size: 0.7rem;
}

.ops-table tr.ops-sum-row td {
    background: var(--h-line-2, #eef1f5);
    font-weight: 700;
}

.dark .ops-table tr.ops-sum-row td {
    background: rgb(255 255 255 / 0.05);
}

/* Account picker (static bankRec: a button per account, the chosen one navy) */
.ops-account-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ops-account-picker button {
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--h-line, #dde3ea);
    border-radius: 6px;
    background: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.ops-account-picker button.is-active {
    background: var(--h-navy, #1a3a5c);
    border-color: var(--h-navy, #1a3a5c);
    color: #fff;
}

.dark .ops-account-picker button:not(.is-active) {
    background: var(--gray-900);
    border-color: rgb(255 255 255 / 0.15);
}

/* Dashboard (module 26) — static .kpis / .kpi cards, balances and activity panels */
.dash {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dash-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem 0.9rem;
}

.dash-head h2 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
    color: #1A3A5C;
}

.dash-head span {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.dash-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
    gap: 0.8rem;
}

.dash-kpi {
    display: block;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-top: 3px solid #1A3A5C;
    border-radius: 0.5rem;
    padding: 0.9rem 1rem;
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.15s;
}

.dash-kpi:hover {
    box-shadow: 0 4px 14px rgb(15 25 40 / 0.1);
}

.dash-kpi.is-gold {
    border-top-color: #F5A623;
}

.dash-kpi-label {
    color: var(--gray-500);
    font-size: 0.83rem;
    font-weight: 600;
}

.dash-kpi-value {
    margin-top: 0.3rem;
    font-size: 1.6rem;
    font-weight: 700;
    color: #1A3A5C;
    font-variant-numeric: tabular-nums;
}

.dash-kpi.is-alert .dash-kpi-value {
    color: var(--danger-600);
}

.dash-kpi-sub {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: var(--gray-500);
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
    gap: 1rem;
    align-items: start;
}

.dash-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 700;
    color: #1A3A5C;
}

.dash-panel-body {
    padding: 0.9rem 1rem;
}

.dash-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-decoration: none;
}

.dash-link:hover {
    color: #1A3A5C;
}

.dash-bar {
    display: block;
    margin-bottom: 0.7rem;
    color: inherit;
    text-decoration: none;
}

.dash-bar-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.87rem;
}

.dash-bar-line b {
    font-variant-numeric: tabular-nums;
}

.dash-bar-line b.is-negative {
    color: var(--danger-600);
}

.dash-code {
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.dash-bar-track {
    height: 8px;
    margin-top: 0.25rem;
    background: var(--gray-100);
    border-radius: 4px;
}

.dash-bar-fill {
    height: 8px;
    border-radius: 4px;
    background: #F5A623;
}

.dash-bar-fill.is-bank {
    background: #1A3A5C;
}

.dash-bar-fill.is-negative {
    background: var(--danger-600);
}

.dash-activity td {
    font-size: 0.85rem;
}

.dash-muted {
    color: var(--gray-500);
    white-space: nowrap;
}

.dash-badge {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background: var(--gray-100);
    font-size: 0.75rem;
    font-weight: 600;
}

.dash-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--gray-500);
}

.dark .dash-kpi {
    background: var(--gray-900);
    border-color: rgb(255 255 255 / 0.1);
}

.dark .dash-kpi-value,
.dark .dash-head h2,
.dark .dash-panel-head {
    color: #fff;
}

/* Module 27a: dashboard «المشروعات الجارية» rows */
.dash-row {
    cursor: pointer;
}

.dash-row:hover td {
    background: var(--gray-50);
}

.dark .dash-row:hover td {
    background: rgb(255 255 255 / 0.04);
}

.dash-negative {
    color: var(--danger-600);
    font-weight: 700;
}

/* Module 27b: report frame (static reports.js) */
.rep-title {
    margin: 0.25rem 0 0.5rem;
    font-size: 1.03rem;
    font-weight: 700;
    color: #1A3A5C;
}

.dark .rep-title {
    color: #fff;
}

.rep-section {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.rep-chart {
    padding: 0.8rem 1rem;
}

.rep-table td.rep-code {
    font-family: ui-monospace, monospace;
    font-size: 0.8rem;
}

.rep-req {
    color: var(--danger-600);
}

.rep-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 0.8rem;
}

.rep-card-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    color: #1A3A5C;
    font-size: 0.95rem;
}

.dark .rep-card-title {
    color: #fff;
}

.rep-card-icon {
    width: 1.15rem;
    height: 1.15rem;
    color: #F5A623;
}

.rep-card-desc {
    margin-top: 0.4rem;
    font-size: 0.83rem;
    color: var(--gray-500);
}

/* Module 28a: forecast / state badges */
.dash-badge.is-success { background: var(--success-50); color: var(--success-700); }
.dash-badge.is-warning { background: var(--warning-50); color: var(--warning-700); }
.dash-badge.is-danger { background: var(--danger-50); color: var(--danger-700); }
.dash-badge.is-gray { background: var(--gray-100); color: var(--gray-700); }
.dash-panel-head .dash-badge { margin-inline-start: 0.5rem; }
.dash-check { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; cursor: pointer; }
