/* MDO Dashboard (team overview) page. Scoped under .mdo-page - see
   FieldDashboard.css / TasksAllocation.css for why every selector here is
   prefixed (this stylesheet loads globally alongside every other page's). */

.mdo-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1f2937;
}

.mdo-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.mdo-title {
    margin: 0 0 6px;
    font-size: 1.6rem;
    font-weight: 700;
    color: #111827;
}

.mdo-subtitle {
    margin: 0;
    font-size: 0.92rem;
    color: #6b7280;
}

.mdo-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.mdo-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    padding: 0.65rem 1.1rem;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}

.mdo-btn-outline {
    background: #fff;
    border-color: #d1d5db;
    color: #374151;
}

    .mdo-btn-outline:hover {
        background: #f9fafb;
    }

.mdo-btn-primary {
    background: #15803d;
    color: #fff;
}

    .mdo-btn-primary:hover {
        background: #166534;
    }

/* ---------- Stat cards ---------- */
.mdo-stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.mdo-stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #cbd5e1;
    border-radius: 10px;
    padding: 1rem 1.1rem;
}

.mdo-stat-total {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff, #ffffff);
}

.mdo-stat-unassigned {
    border-left-color: #6b7280;
    background: linear-gradient(135deg, #f3f4f6, #ffffff);
}

.mdo-stat-requested {
    border-left-color: #7c3aed;
    background: linear-gradient(135deg, #f5f3ff, #ffffff);
}

.mdo-stat-approved {
    border-left-color: #16a34a;
    background: linear-gradient(135deg, #ecfdf5, #ffffff);
}

.mdo-stat-progress {
    border-left-color: #d97706;
    background: linear-gradient(135deg, #fef3e2, #ffffff);
}

.mdo-stat-completed {
    border-left-color: #0f766e;
    background: linear-gradient(135deg, #f0fdfa, #ffffff);
}

.mdo-stat-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.mdo-stat-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
}

.mdo-stat-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.mdo-stat-total .mdo-stat-icon { color: #3b82f6; }
.mdo-stat-unassigned .mdo-stat-icon { color: #6b7280; }
.mdo-stat-requested .mdo-stat-icon { color: #7c3aed; }
.mdo-stat-approved .mdo-stat-icon { color: #16a34a; }
.mdo-stat-progress .mdo-stat-icon { color: #d97706; }
.mdo-stat-completed .mdo-stat-icon { color: #0f766e; }

.mdo-stat-number {
    font-size: 1.7rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.mdo-stat-desc {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 2px;
}

/* ---------- JMDO-wise summary table ---------- */
.mdo-table-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem 1.75rem;
}

.mdo-table-title {
    margin: 0 0 4px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
}

.mdo-table-subtitle {
    margin: 0 0 1.25rem;
    font-size: 0.88rem;
    color: #6b7280;
}

.mdo-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mdo-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

    .mdo-table th {
        text-align: left;
        font-size: 0.88rem;
        font-weight: 700;
        color: #111827;
        padding: 0.9rem 0.75rem;
        border-bottom: 1px solid #e5e7eb;
        white-space: nowrap;
    }

    .mdo-table th:first-child,
    .mdo-table td:first-child {
        padding-left: 0;
    }

    .mdo-table td {
        padding: 1rem 0.75rem;
        border-bottom: 1px solid #f1f5f9;
        font-size: 0.92rem;
        color: #111827;
        vertical-align: top;
    }

    .mdo-table tr:last-child td {
        border-bottom: none;
    }

.mdo-jmdo-name {
    font-weight: 700;
    color: #111827;
}

.mdo-jmdo-sub {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}

.mdo-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 14px;
    padding: 4px 12px;
    white-space: nowrap;
}

.mdo-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mdo-status-active {
    background: #dcfce7;
    color: #15803d;
}

    .mdo-status-active .mdo-status-dot {
        background: #15803d;
    }

.mdo-status-leave {
    background: #fef3e2;
    color: #c2662a;
}

    .mdo-status-leave .mdo-status-dot {
        background: #c2662a;
    }

/* ---------- Tablet (768px - 1199.98px) ---------- */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .mdo-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ---------- Phone (<= 767.98px) ---------- */
@media (max-width: 767.98px) {
    .mdo-page {
        padding-top: 12px !important;
        padding-bottom: calc(16px + var(--safe-bottom, 0px)) !important;
    }

    .mdo-title {
        font-size: 1.25rem;
    }

    .mdo-header-row {
        flex-direction: column;
        align-items: stretch;
    }

    .mdo-header-actions {
        width: 100%;
    }

    .mdo-btn {
        flex: 1 1 0;
        justify-content: center;
        min-height: 44px;
    }

    .mdo-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .mdo-stat-card {
        padding: 0.85rem 0.9rem;
    }

    .mdo-stat-number {
        font-size: 1.4rem;
    }

    .mdo-stat-icon {
        width: 26px;
        height: 26px;
        font-size: 0.82rem;
    }

    .mdo-table-card {
        padding: 1.1rem 1.1rem;
    }

    /* Table becomes a stack of cards, one per JMDO, instead of a
       horizontally-scrolling grid. */
    .mdo-table-scroll {
        overflow-x: visible;
    }

    .mdo-table {
        min-width: 0;
    }

    .mdo-table thead {
        display: none;
    }

    .mdo-table,
    .mdo-table tbody,
    .mdo-table tr,
    .mdo-table td {
        display: block;
        width: 100%;
    }

    .mdo-table tr {
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 0.9rem 1rem;
        margin-bottom: 12px;
    }

    .mdo-table tr:last-child {
        margin-bottom: 0;
    }

    .mdo-table td {
        border-bottom: none !important;
        padding: 6px 0;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        text-align: right;
    }

    .mdo-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        text-align: left;
        flex-shrink: 0;
    }

    .mdo-table td.mdo-cell-header {
        display: block;
        text-align: left;
        padding-bottom: 10px;
        margin-bottom: 4px;
        border-bottom: 1px solid #f1f5f9 !important;
    }
}

@media (max-width: 420px) {
    .mdo-stats-grid {
        grid-template-columns: 1fr;
    }
}
